diff options
author | Tor Norbye <tnorbye@google.com> | 2014-02-27 16:41:16 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-02-27 16:41:38 -0700 |
commit | 88f318c9bf709fa5700350636925f2c46d6ae08d (patch) | |
tree | 56757c71de659269f7503764264777a3519d402e /platform | |
parent | 0ecdb5090b29e51adc5322347bafda41760653ea (diff) | |
download | idea-88f318c9bf709fa5700350636925f2c46d6ae08d.tar.gz |
Snapshot 34f078c3452e79ba209d28a551962857e0970e5d from idea/134.1342 of git://git.jetbrains.org/idea/community.git
34f078c: WEB-11147 NPM: Upgrade is disabled for package that was selected before it's version was fetched
caa3d13: Slim. Parser skipps leading comments and line breaks
7b58b81: IDEA-121215 (Java 1.8: "Interface may be annotated with @FunctionalInterface" inspection should not report @interfaces)
4f97ffe: don't reuse progress indicator in ctrl+mouse handler (EA-53958)
95a36c3: IDEA-121294 Toggling breakpoint with a mouse causes unfolding of a section
583c5a7: IDEA-121301 Setting a breakpoint after navigation to a folded method
245f457: cache jar root path
56ca4df: drop memory usage indicator old style
c049454: improve error reporting
72bac20: IDEA-109979 The ability to set breakpoints in the breakpoints edit window
f400bdc: CR-IC-4385 move util method to util
f6ff78b: notnull
847aa41: cleanup
5bd112a: Marking following plugins as broken NodeJS 134.1276 Php 133.982 Ruby 6.0.0.20140207 Karma 134.1163 JSTestDriver 134.1163
aea523f: Cleanup (deprecated code; formatting)
7d90896: Cleanup (missing delegation)
f9371d5: Cleanup (loop invariant; duplicated code)
38269aa: Cleanup (formatting)
7d3368b: java: PsiType documentation corrected
f288bdc: Cleanup (pointless null check; formatting)
d173a3e: IDEA-46403 Breakpoint on an empty line
e0e750e: don't queue breakpoint ui update if nothing changed reuse old CustomizedBreakpointPresentation
0ba4d7e: Gradle description
547cce7: Merge remote-tracking branch 'origin/master'
dff66d2: add JDK statistics
a90591f: Merge branch 'python-fixes'
ae1e6ca: Better error recovery for lines with single 'class' or 'def' keywords and normal functions defined below
10c8b99: support UI state for toggleable selected actions
b1dd00f: icon wrapper for selected toggleable actions' icons
8b4df90: re-think and make it usable in PoppedIcon
83f082f: dispose created marker for good
a39c3b7: Better error recovery for blocks with missing ':' and non-empty bodies
9b8a6cc: Fixed unmached parentheses in test data
9186334: a test for IDEA-116706 Unselect word at caret doesn't work reversing through lambdarized anonymous class
2cb92f2: fix isEnabledCondition
c47a26d: cleanup
60316b6: spelling
4a50ed6: use SmartList
788e5a0: cleanup
628b30a: cleanup
2efcf47: suppress warning
876a793: new test
3f8471c: @Nullable
18f2aee: optimize resolve. In some cases resolve() works faster than resolveGenerics (for example in LiteralClassType) and does not need to infer type parameters which can are needed only after some checks
3f460bc: language level is not @NotNull
37fcda8: simplify code
76d9c82: typo
d85d9f7: lazy inference of closure parameters' types some renames and cleanups
7874795: Disable fullscreen for the sheet parent
88a57a0: Merge remote-tracking branch 'origin/master'
7788a2f: PY-12173 Extract Superclass: warn about conflicting names
0fb4704: diff: fix EditSource action description on toolbar
feaf1fa: fix double icon in available plugins table
c332536: move Sort Installed First to context menu
5ad1016: move Sort by Status to context menu
09bd5b3: Fixed error recovery after empty blocks with no indent
2956e56: PY-12179 Pull up: do not show dialog when there is nothing to pull up
17a06dc: EA-54364 - CCE: SuppressionAnnotationInspectionBase$SuppressionAnnotationVisitor.visitAnnotation
6033fa8: provide type parameter based type with site substitutor to be accepted during type arguments check
2f69c1e: notnull
a575173: moved to community
b8d01ff: CR-IC-4490 Make EnforcedPlainTextFileTypeManager use only project configurations (fixes IDEA-120941)
84279e1: warn only on method parameters
cc9d5bb: IDEA-70465 Multi selection + making it working with live templates
792ea73: WEB-9670 'Surround with Emmet' doesn't work with block selection
1270d02: Live templates and multicaret: stop template at the first variable or end marker
14837f9: Enable multicaret for live templates
6fcc639: IDEA-121193 Don't show 'Class already exists' error if there are two groovy classes with the same qualified name in different modules
6e2687a: CR-IC-4514 @NotNull
2f8c679: cleanup
d4e0fec: Merge remote-tracking branch 'origin/master'
dd8e7fe: Merge branch 'svn_18_3'
78a3523: restored platform prefix autodetection to fix sql tests
5057388: svn: Fixed NPE in SvnConfiguration - initialize inner state to default value
1c5b685: IDEA-95011 diff: better handling of FilesTooBigForDiffException in merge dialog
c599d55: IDEA-121140 Format spock DSL in script body
841e5c6: isRetina fix for headless mode reviewed by kb
685e871: Merge branch 'disable-strings-no-effect'
be10b84: Disable 'Statement has no effect' for all string literals (PY-12194)
ca00903: use embedded tokes for templates instead of injections #WEB-11115 fixed
b671182: Platform: disabled image interpolation on resize in the viewer (IDEA-98635)
f48afb5: Merge remote-tracking branch 'origin/master'
151071e: EA-54197 - IAE: HgTagBranchCommand.collectNames
6a669b7: avoid stripping whitespaces on caret lines on document save (IDEA-80056)
28437d6: diff: fix typo
a10b616: Merge remote-tracking branch 'origin/master'
ea29fa7: Fix incorrect foremost window detection (IDEA-121261).
6e9ac43: Merge branch 'svn_18_3'
9b637e5: for loop -> forEach call chain inspection
e967a04: redundant lambda param types: take site subst into account
994eb2c: junit: do not treat config methods as tests (IDEA-121162)
470d4d0: PY-12213 When moving, members should be sorted according to their dependencies
8f75528: enable new DSM legend for retina & darcula
581f3c4: svn: Refactored SvnConfiguration - settings persistence implemented using PersistentStateComponent<State> class (and not using general PersistentStateComponent<Element> class)
1424a3a: svn: Refactored SvnConfiguration - removed SvnSupportOptions class (logic moved to SvnConfiguration itself)
8d03b3a: Merge remote-tracking branch 'origin/master'
7eb7546: DB props: reuse F4 as part of DataSourceElement.navigate() and drop 'Enter' shortcut
d22be0b: make CaretModelImpl.setCaretsAndSelection() implementation follow contract of interface method (IDEA-80056)
d1752c1: introduce IdeResourcesTestCase: Ultimate & DBE versions
c6d8ea2: Merge remote-tracking branch 'origin/master'
1f69774: NPE fix
5fa2055: Merge branch 'python-live-templates'
76d43e8: WEB-9926 remove 0xhh postfix (property name)
e9c49a1: Added Python live templates for '__main__', 'for' loops, comprehensions, properties (PY-2378)
5e2bf99: IDEA-121202 Step Into doesn't step into a lambda
1be8e04: IDEA-121057 Multiple Carets: Alt-N works in "whole word" mode if the whole word is initially selected
cbbae06: cleanup bean code
b865331: Merge remote-tracking branch 'origin/master'
94b34e9: Merge remote-tracking branch 'origin/master'
6e82d2d: Message header wraps long strings now
e4bb391: IDEA-121227 latest IJ mac builds: Cannot load JVM bundle in case of Java 1.7
138f7f8: Icons improvement
e200179: moved template language setting to the integrated tools
29068e1: png optimization
1686207: Merge branch 'svn_18_3'
a2619760: new debug helpers
7e75d80: Mnemonics
ff028dd: IDEA-103473 Correctly handle paths different only by case on case insensitive file system during commit - use just paths or specialized api for comparison
1ae54aa: IDEA-121099 Ctrl + Shift + Arrows doesn't work with multiple cursors
a578b4a: svn: Use idea home directory as working directory for "move" operation when move paths differ only by case for case insensitive file systems
6aefd30: Resources/Template roots -> Project structure
b8abb8f: add @NotNull to CompletionData.objectToLookupItem
75fdf53: don't choke on non-physical classes in resolve (EA-53892 - IAE: ResolveScopeManagerImpl$.compare)
1d44099: EA-54072 - assert: StubBasedPsiElementBase.getNode
38f2c99: EA-54221 - AIOOBE: ImmutableText.charAt
a717fce: EA-54222 - NPE: TemplateState.setCurrentVariableNumber
0ecb335: IDEA-118988 completion could add 'value=' in annotation
30a899f: add an explanatory comment to com.intellij.ide.macro.EditorMacro.getColumnNumber
e3fde06: use StubIndex.processElements where possible
a91570c: CR-IC-4499: deprecate StubIndex.process, satisfy Maxim's sense of beauty
393b67f: tests repaired
968404a: Merge remote-tracking branch 'origin/master'
6ded813: new inference: most specifics, varargs case
89aefc8: new inference: non-wildcard parameterization
8d60b8d: drop secondary carets when entering/exiting column selection mode (IDEA-80056)
bda5184: Merge remote-tracking branch 'origin/master'
9d41bae: Animator instead of Swing Timer
cddde85: make multi-caret selection with keyboard in column mode work more like old block selection (IDEA-80056)
5601899: Slim formatter started
0826b4a: fix can't read message for IDEA-121207
87ef851: IDEA-121182 Plain text autodetection isn't rerun on file content change
bbd2363: notnull
8248670: notnull
ca9faaa: notnull
1490fb8: moved back to analysis
d2bd356: moved to editor-ui
0b53dbe: IDEA-121220 Focus remains on Document tabs instead of Editor area when tabs switching
34a5343: cleanup
760c3b6: jps plugins to use 1.6 language and bytecode target level
e699813: NodeJS 134.1163 isn't compatible with EAP
e58ef02: Make EditorToggleColumnMode action work with multiple carets like previously with block selection (IDEA-80056)
eb39a65: ensure API backward compatibility
4d26c0a: platform: system notifications reworked
8b2e547: force 1.6 language level for jps-builders
ea1e764: Merge remote-tracking branch 'origin/master'
1b50ea2: lambda -> anonym: disable in unexpected context where cast won't help (IDEA-120165)
f4e209c: lambda -> anonym: additionally process method calls as they may clash with resulted class methods (IDEA-120469)
a745e5a: Merge remote-tracking branch 'origin/master'
b178187: continue gutter layout (don't process all console lines to compute max width)
e521e77: IDEA-111990 Don't close about on blur
82110ac: 1-to-1 mapping between Caret instances for injected and main editors (IDEA-80056)
c074bd2: 1-to-1 mapping between Caret instances for injected and main editors (IDEA-80056)
ff01b5b: get rid of duplicated code in editor fixtures (IDEA-80056)
70aaf37: external build: renamed system property to avoid clashes with user-defined properties for Maven resource filtering (ZD-22524)
78fcfe8: Platform: GenericKeymapManager for IDEs other than IDEA
7589de1: IDEA-2870
64721a2: methods usage index uses mappings
da6e3d8: leave shift + F11 only for bookmarks in JBuilder keymap
ef553f6: IDEA-96651 "Alphabetical order for tabs is ON" warning
e796dc6: make myPressPointScreen accessible in processDragFinish
f130fdc: Merge remote-tracking branch 'origin/master'
ce2d2ec: IDEA-91530 Tab highlighting error when sorted alphabetically
43fdfb2: Spellchecker : IDEA-120568 add gzip (cherry picked from commit 9204f00)
24fbf80: anonym -> lambda: check initializer inside constructor for final fields (IDEA-120698)
44dde64: anonym -> lambda: do not suggest when forward references are detected (IDEA-120699)
b716f47: more consistent highlight "type#selector"
7a9bf2a: reject 1.7 varargs hack as 1.8 reject the code again even with target 1.7
2df995f: More extensibility for CoreProjectEnvironment
b4eba39: move xml descriptors to the module available from Upsource
aa61e88: EA-54181 - NPE: NullableStuffInspectionBase.checkNullableStuffForMethod
f64f1ef: do not suggest broken plugins
7a70428: lambda: accept ellipsis parameter when array expected (IDEA-117124)
d7d0eec: extract method with new inference
351b9b1: tests left on 1.7 for now
8f7ff5b: wrap with command
e0ce9de: testdata
f1b256f: forbid lambda in conditional inside cast context
232f8bd: new inference: strict subtyping: skip raw types
828cb5a: new inference: erase return type if unchecked conversion was performed
01b095b: check myDisposed in read action too
e29d48f: EA-53239 - UOE: VirtualFileImpl.getChildren
9d2947e: IDEA-121192 Fix query construction and update test
92ac042: RemoteSdkCredentials retrieval extracted from RemoteSdkAdditionalData.
17b78eb: show "native" description for node objects
84aa4e8: we must use case-sensitive natural compare — constants must be first, but our naturalCompare is "buggy", so, we perform manual sort before call platform function
5ef006c: WEB-9926 don't auto expand library scope, we must use case-sensitive natural compare — constants must be first
5ac875b: Correct API version is initialized next time JIRA repository is read from settings
4be43ba: WEB-10887 TypeScript: unexpected error occured when Import clause with immediate export
a8c7d79: compact view for installed plugins
a216ae3: DBE: manage data sources action
cd5c3c9: check there are at least 2 tabs are open for move operations
479f584: move to right and move to down actions
0120c91: Generify to support move to right and move to down actions
1cc06ea: text will be assigned automatically
e167ddf: github: fix tests
5a6339b: github: assert -> warning
4edfd8e: remove possible deadlock on network operation in EDT
3d789e3: temporary fix for completion issue (IDEA-80056, EA-54248)
c598b17: @TestOnly
a23a0a6: diff: do not forget about start offset
e17305a: diff: optimise reindexer
0c614ba: IDEA-121031 Plugin Manager: "Update plugin" button does nothing
f32b77f: use install icon and fg/bg on update button
48921af: console gutter component should use setAdditionalColumnsCount now (we use editor area) rename outdated historyAnnotation
32209cb: fix About dialog font on Windows
68e033e: IDEA-121138 Tab completion does not work in autopopup
1c21d1d: Platform: empty text accessor for NewErrorTreeViewPanel
8d25634: DBE: customize editor empty-text ad
a96ee36: fix case in test data file name
5239b11: add help id
e5fe842: better font sizes for Windows and Linux
621a2b3: Git Update tree stays black after switching to Darcula
9d167d2: IDEA-120787 MySQL Comment with Block Comment inside block comment should uncomment; affected for all SelfManagingCommenters
46061a0: introduced REFORMAT_BLOCK_ON_RBRACE property
2d4efe7: project structure dialog: hide library types irrelevant to the current project from 'Global Libraries' -> 'Add' action
9b71864: project structure dialog: hide irrelevant to current module libraries (e.g. JavaScript libraries in Java module) in 'Add Library to dependencies' chooser
1ca73f4: final
3f3e013: simplify ctor
63ec0ea: Merge remote-tracking branch 'origin/master'
17bc69d: added application root to the SDK search path on window (Education Edition attempt)
e26dc5b: IDEA-120157 Reformat code ignores keep dependent methods together order
9173579: new DSM legend
26ff86f: typo
06933eb: IDEA-117902 Commit message wrapping behaves strangely
adaef15: rearrange checkbox in reformat files dialog moved before "only VCS changed text"
e52b01a7: an API to avoid CCEs when doing StubIndex.process
d55d2bb: rename physical->eventSystemEnabled to reduce confusion when constructing FileViewProvider
f786d1e: IDEA-120066 Auto indent on closing curly brace
7f105db: Compilation fix
57ebb86: Cleanup (interface adapter)
3686918: Merge remote-tracking branch 'origin/master'
41624fb: merged
0f39a4c: method refs: restore error on invalid array creation
07de151: AIOOBE
b587af7: exact method refs most specific: void compatibility
527e1de: runSingleTest(Runnable) extracted for parameterized tests
7544243: platform project open processor starts to work as last one, to avoid its interception with SBT / Gradle / Maven / etc (IDEA-121111 )
e37b853: avoid invalid regions
ca5b739: check disposed in read action (EA-53960 - assert: ComponentManagerImpl.getPicoContainer)
307a9b9: github: assertion relaxed for tests
19a1516: Cleanup (pointless exceptions dropped; test reformatted)
dd456d2: Cleanup (typos)
bdf35bd: Cleanup (unneeded cast)
7f5ae7e: Cleanup (formatting)
b877311: Cleanup (unneeded test case inheritance)
d128928: Cleanup (configuration tests correctly generified and annotated)
d9dcac5: Cleanup (typos)
6cc57f8: EA-54183 (CCE: BooleanConstructorInspection$BooleanConstructorFix.doFix)
cf00d70: delete old inference strategy for java 8
96af56c: AIOOBE
2f80e7d: new inference: reject partial computation
72c51dc: configurable oneLineInput
7130e5e: cleanup
c2a4f0d: IDEA-80056 Column selection mode improvement
a5c59c2: github: fix 'open in browser' url
4d7c38f: recover from EA-53754 - IOOBE: CharSequenceSubSequence.<init> (BlockSupportImpl) not only in internal mode
26a4855: hide psiFileFactory
fdee766: IDEA-117332 Change signature refactoring should warn about @Contract conflict
cc56534: IDEA-118094 smart completion in annotation: allow exclude
a3548b0: Fix for focus traversal.
825f767: NPE fix in FormatterTagHandler.getFormatterTag()
ac15549: structure view extracted
9739a4d: javadoc
68c3a40: nullable
53b173e: cleanup
1e7bbca: moved to xml-analysis
7693bbc: cleanup
75ca104: notnull
cad71fe: notnull
e65df65: cleanup
b53845b: notnull
e5df149: moved to core
b4d9fc6: notnull
aa5bc16: moved to core
8e38503: notnull
9a997d1: moved to editor-ui
a816b5d: moved to editor-ui
b1818fc: moved to editor-ui
64b597f: notnull
72e86eb: notnull
a4b1105: cleanup
3c9e26a: removed dependency on FileEditorManager
5f12f65: moved to editor
001957a: moved to core
9f26603: moved to editor-ui
bc83d33: moved to core
745381b: NotNull
4ef4bad: moved to core
ca75131: NPE
4715a42: add file validation on show execution point
09954a9: nodejs doesn't report actual locations after set breakpoint
f97c3ae: nullability
78ef38e: cleanup
6033db3: eliminate WebBrowserBase
0ea4a4b: IDEA-80056 Column selection mode improvement
99dab77: IDEA-80056 Column selection mode improvement
65fc838: Merge remote-tracking branch 'origin/master'
3abd020: fixed NPE
33a6a8c: EA-54164 - assert: FileManagerImpl.findFile
a97592b: Search for unique names that don't clash with anything in mock SDK
569a8ba: Reset module name index in mock SDK setup for reproducible test results
62db067: Merge branch 'python-fixes'
a7e01b8: Don't suggest Python live templates after '.' in qualified names
948ad3e: new inference: ensure type parameters are not modified during ground type evaluation
6a38fba: new inference: avoid current type calculation during conflict resolution for target type detection (IDEA-121052)
edf1d19: don't load modules from disabled plugins
019aa0a: unused field
83a5ada: IDEA-117643 use a correct file for searching for binding variables. Complete binding variables in debugger's watch editor
45c7715: duplicated code
7b9be7e: IDEA-117643 don't add parameters for binding variables. Just try to infer them as they are.
aeb3292: IDEA-119691 Groovy: References to outer class properties should be resolved to accessors if they exist. Fields are prefferable only inside its containing class (not inside inner classes of the outer class)
c41376f: CPP build
add0457: Merge branch 'goto-module'
5897600: Changed the visual representation of PyFileImpl to be more Python module-like (PY-6923)
bdac622: Added Python modules to 'Navigate to class' and 'Navigate to symbol' results (PY-6923)
6c401b1: Added Python module names index (PY-6923)
751a087: EA-46543 (diagnostic)
a91b1d0: Merge remote-tracking branch 'origin/master'
31ea501: grab focus in show all action from interpreter combobox
f6be520: remove association if vEnv associated with different project was selected
6df7c8d: Move GroovyImporter back to org.jetbrains.idea.maven.importing , bacause it used from some plugins.
69b7118: WebBrowserManager API post review
e051d7a: looks like there are a lot of clients assuming default JTable scrollable viewport size (450x400)
8111501: diff: fix action name
8c6f416: IDEA-121050 diff: fix typo
644139e: IDEA-120993 diff: fix diff range calculation in case of newline at the beginning of file
41921f7: diff: rename action
6be4951: diff: add generics
7458f32: github: add assertion
04d6c56: diff: do not fail completely on by-word comparison of two extremely big lines
997c1b2: diff: ask to show content of equal files
74153c9: diff: @Nullable
b285dea: diff: do not call read action to access to local read-only document
7058ea2: IDEA-80056 Column selection mode improvement
fe84447: IDEA-80056 Column selection mode improvement
24763b6: IDEA-121074 Make JIRA remote API version undefined only on actual URL change
964fcf5: java 8: final and default/static in interfaces
d2c3b4b: more specific inference: do not compare functional types if both methods were generic
e42ff74: testdata for IDEA-120992
217a1fd: new inference: address anonymous classes (IDEA-121063)
0f023fa: testdata for IDEA-121055
6900ca8: IDEA-121077 Fix JQL query construction in JIRA connector
d2513fa: java: wrong method used
9fd2a22: groovy: not-so-fast performance test excluded from the suite
6c6ac37: java: ability to skip slow tests
f2ed5a6: Cleanup (platform tests moved to platform)
9c85eb9: Cleanup (dead code; readability; typos; annotations)
0799e8b: Cleanup (common class extracted)
815bba3: pass project to psi file factory
00f817a: LanguageConsoleImpl is not intended to be extended
0b90dc8: add todo note
2c034c0: implement ConsoleJavaScriptInspectionFilter
a38c63c: new inference: isAcceptable for method reference
a4deb4d: new inference: isAcceptable for lambda
de7f053: new inference: do not accept varargs when array is passed there
9fc4b68: new inference: take into account site substitutors during additional constraints gathering
6a5b57d: dispose previous root model when changing to a new one without events
751ec20: save one volatile read on each charAt in editor
5349f1e: language console: revert "disable DaemonCodeAnalyzer "
db3a3d6: Fixed incorrect YesNoCancel behaviour, html in message is handled properly now, size of text in the message is taken into account, esc works properly, better message width and height calculation based on the text area and number of buttons in the message.
c582c37: fix offset calculation remove incorrect call — it is right gutter responsibility
406255c: update notifications about not installed pip/setuptools
fb25259: js repl: setOneLineMode true (will be or not moved as platform default after discussion)
3996201: disable DaemonCodeAnalyzer for console editor — the same as EditorTextField does +review
74f1397: fixing compiler storage data integrity for certain cases when classes are moved between modules
9491e6d: IDEA-120625 Save file as template
1a50247: IDEA-116706 Unselect word at caret doesn't work reversing through lambdarized anonymous class
374e421: IDEA-76185 Macro: $SelectionStartColumn$ and $SelectionEndColumn$ external tools macros count tabs as expanded spaces
4e1ae10: PathMacroMap: add clarifying comments about by-reference string comparison
3510a84: setAdditionalLinesCount = 1
0d4ce76: don't set setRightMarginShown twice — ConsoleViewUtil is enough
a51adfb: LanguageConsoleImpl is not intended to be extended
b792a8c: cleanup
bcaeaeb: cleanup
bbae05d: deprecate createActions — LanguageConsoleImpl is not intended to be extended (actually, it is not used in our code, but we keep method to ensure backward compatibility)
752e268: cleanup
0dbe448: add isEmptyCommandExecutionAllowed, by default true
ec8a5d2: IDEA-80056 Column selection mode improvement
83550bf: Merge remote-tracking branch 'origin/master'
f85aa38: IDEA-120866 Improve usability of 'Uninstall old version(s)' step
ffd542c: CR-IC-4381#c22616
62acb09: Show error message when disable broken plugin.
5a79c28: CR-IC-4381#CFR-71852
90e7243: CR-IC-4381#CFR-71852
a5f7dd7: accidentally committed — revert
3437a1e: optimize imports on project: exception fixed, removed unused method invocation
638f8f1: don't setup delegating color scheme twice — ConsoleViewUtil is enough +review
d785cf6: @NotNull
55e67f6: don't execute empty command
5febcfe: isEmptyOrSpaces accepts CharSequence +review
2610e6c: cleanup
5a83918: deprecate setTextToEditor
975ad62: overrides
c76c841: Merge branch 'master' of git.labs.intellij.net:idea/community
8bd736a: show all in project interpreter combobox regardless virtualenv association
4518cf9: Merge remote-tracking branch 'origin/master'
ce073a75: PY-12196 Members moving refactoring should handle dependencies
b353744: IDEA-120038 - Redesing Git cloud frameworks UI - upload SSH key from account
dbe4736: WEB-11067 Karma Plugin broken because of missing intellijCli Node module
3fb9b1a: fix layout (IDEA-121036)
61bac55: Add "JSTestDriver Plugin" plugin to brokenPlugins.txt
9583062: Postfix completion: do not show 'enable template in autopopup' checkbox if show.template.in.completion.list is enabled
e896024: Postfix completion: apply throw template on Throwable only
79e95dc: Postfix completion: do not apply null, notnull and instanceof template on primitive types
4ddf754: Postfix completion: extract condition constant
1ae8c8c: notnull/nullable
f124013: NPE fix
dc27b12: Add SBT plugin to brokenPlugins.txt
406ebb4: Do not store virtual files in map that is never cleared for IDEA-120732 (Throwable at com.intellij.cvsSupport2.actions.IgnoreFileAction$1.run)
0cfd079: make final
68a8f15: fix CR-PY-5915
5d124b0: fix method isn|'t implemented: com.intellij.execution.console.ProcessBackedConsoleExecuteActionHandler com.intellij.execution.runners.AbstractConsoleRunnerWithHistory#createConsoleExecuteActionHandler() (in Pythonid:3.1.1.134.1462)
52ac45a: deprecate finishExecution()
ce1c1a4: don't expose createConsoleExecAction
c524fb2: cleanup
3ab1740: Merge remote-tracking branch 'origin/master'
cd937d1: better class naming
709bbc0: better class naming
c6ad195: Merge branch 'python-fixes'
4a5c63e: add MarkupModelListener.Adapter
ff1625e: cleanup
8af73b7: Don't resolve to file-level '__metaclass__' in PyClass.getMetaClassExpression() (PY-12127)
abd4c25: IDEA-80056 Column selection mode improvement
14d837e: IDEA-120526 Groovy: Inline super.call()
7065641: IDEA-120979 Static method call in instance context
970da58: fix contracts
4fdbc8c: IDEA-120885: complete 'as' keyword in appropriate place
8342f32: fix JsDebugConfigurationConverterTest
993f8c1: Test fix; cleanup (formatting)
987d9d4: IDEA-120931 Threads tree in "Debugger" pane displays incorrect thread name
9db0214: IDEA-120994 Debugger: tooltip on multiline string value - no need to escape quote characters
ef685df: test fixed
cd39c84: remote templates
3582560: Merge remote-tracking branch 'origin/master'
7de9df1: fixes according code review
59b76f6: suppressed for tests
6a696ee: create project from template: radio button replaced with checkbox
9e8ad70: IDEA-80056 Column selection mode improvement
c1073f8: CR-IC-4035
aa2ed97: Add jira to build in community
b11d66e: new inference: method refs: do not include containing class type params in inference
bac3191: new inferencve: do not apply substitution twice for additional constraints
2a16fd1: new inference: lambda functional type detection
3093e7e: testdata fixed
97b25c1: BaseProgramRunner must be internal
68eb92a: EA-54083 (diagnostic)
0bff0b9: ProcessBackedExecutionEnabledCondition must not be public (and originally was not intended, but we keep backward compatibility)
1b0e049: cleanup
16ae520: ConsoleExecuteActionHandler renamed to ProcessBackedConsoleExecuteActionHandler, keep backward compatibility
b7f131a: ConsoleExecuteActionHandler renamed to ProcessBackedConsoleExecuteActionHandler
415bd34: ConsoleExecuteActionHandler renamed to ProcessBackedConsoleExecuteActionHandler
78a6a8b: remove ruby variant of ConsoleExecuteAction — platform implementation is enough simplification — ConsoleExecuteActionHandler could be also as Condition (we must rename this class to ProcessBackedConsoleExecuteActionHandler — todo)
0912938: cleanup
dec28d2: revert unfinished changes
9495ef2: IDEA-119396 (be picky about unfinished annotated new array expressions)
ead0734: Cleanup (test moved to platform)
3f5ed3f: IDEA-120952
0850b33: Merge remote-tracking branch 'origin/master'
3e4618e: Modify test to attempt to set required initial state, if it's wrong
c068d8e: Fix build due to moved jira module.
eda25d0: Add missing module to layout.gant
9781b1d: IDEA-119819 (Cannot suppress warnings for inspection "Unnecessary unicode escape sequence")
f1f14d5: use setRightMarginShown instead of nullify color +review
8d11adf: overrides
718ee80: IDEA-80056 Column selection mode improvement
62ec1ba: js repl: editor ask us to paint line 4-6, but we should draw line for line 3 (startLine - 1) also, otherwise it will be not rendered fix layout
30e3163: Taking into account Oracle bug 8019291 it is better do not set this property for this transient window than see strange decorations on the transient window.
c814d70: do not embed js into "on" prefixed unknown attributes
3886bc2: Set location of splash screen basing on the current screen device.
f56d570: CR-IC-4445 show whole table by default if it's inside scrollpane
821a6c3: js repl: fix layout
76637d3: LicenseDialog: tuning. LoadingDecorator: rollback
eb161bf: Merge remote-tracking branch 'origin/master'
0c27db7: removed over logging, not informative messages from updater logger.
6abf38a: IDEA-80056 Column selection mode improvement
ed0dc5c: Merge remote-tracking branch 'origin/master'
fbafcac: fixed PY-12186 Project interpreter: not able to select element in appeared settings menu
22da9d4: Updating file properties -> Initializing file system cache (IDEA-115130)
567602b: IDEA-120976 'Complete' work is mentioned 3 times in a simple sentence
4392d23: reverted
089d059: updater: patch applier made tolerant to missing log dir parameter
1305416: zebra-mode enabled
e024d71: WEB-11069 unexpected vertical scrollbar in Bower integration; Review CR-WS-326
d1af527: IDEA-83657 Can't find text in files under .idea
1d9e5df: walk non-indexed files when searching for whole words (IDEA-120648)
09450b1: make go to declaration shortcut also work on console hyperlinks (IDEA-120911)
bfdc9c9: js repl: draw line separators using range marker highlighter
e66c805: EditorEx returns MarkupModelEx (the same as DocumentEx) +review
8efac81: nullability, consistent parameter name
a94a51e: IDEA-120054: Maven: war: non-filtered resource is not copied to output
99ca505: restore clicking on console hyperlinks
f3e9a1e: IDEA-112815 (IDEA does not ignore directories specified in .cvsignore)
85db4a5: use balloon instead of error dialog
713c3d9: cache large leaf element text strings
2f36f24: enable show.live.templates.in.completion by default
16dab5a: IDEA-120911 follow link by keyboard
396d5ec: advance bomb
d0e3130: add jira to tasks plugin
96c8508: remove excessive templates
cbee5a3: clarification
44b16d0: Cleanup (manifest inspections .html files)
54bfa05: new inference: lift also unknown vars (IDEA-117530)
88d220f: new inference: cleanup from eliminateWildcards
e104084: new inference: cleanup checkFunctionalType
1563225: new inference: cleanup from eliminateWildcards
c0f1310: new inference: accept null = Object constraint
1b0e87f: java 8: allow to cast to intersection types
d22feaa: meaningful toString
bd681be: new inference: 18.5.2 adjustments
6103980: bound promotion for super wildcard (? super A (bound extends A) == A)
a91c7f7: bound promotion for super wildcard (? super A (bound extends A) == A)
f3bbc7a: new inference: cleanup
15740a3: new inference: cls copy replacement
4ba1e5f: NPE
1a5e473: AIOOBE
c5d0b16: new inference: debug
555b8b3: new inference: 2 phase resolution
19ba9d8: new inference: resolve
694432f: new inference: capture conversions in return types initial; variable dependencies
758fa4a: rearrange on multiple files continues if no rearranger found for one of them
3e8ca79: IDEA-34877 (CVS: check whether the new-added file name exists in .cvsignore and don't prompt to add it) & IDEA-120736 (CVS: don't prompt to add new-created files ignored using IgnoredFiles list)
10a58c5: Cleanup (extra write action)
1c8930c: Cleanup (double commit)
4f1c289: License Dialog: windows tuning. cleanup
a77da47: LicenseDialog: JetProfile assets choice & proceed
c83ed1d: Merge branch 'svn_18_3'
a472d35: svn: Optimized IdeaCommitHandler - track deleted files only if required (corresponding parameter is set)
045a753: Display conflicts if destination class already has some member
31c7494: let's start async cache update for EAP
342cf54: Merge branch 'svn_18_3'
fbf5d55: js repl: in/out markers done
cf9ace3: svn: Do not check repository protocol (just working copy format) when determining which implementation (SVNKit or command line) should be used for commit operation
ff65c9f: platform: safe project model modification
93b33a3: svn: Refactored SvnCheckinEnvironment - utilize IdeaCommitHandler as event handler for SVNKit commit flow
45cf910: move prepareExecuteAction to LanguageConsoleImpl instance
06062ed: Retina support + no dialog resize (just image clip)
65531b1: fix test data
894d4bb: remove duplicated code — DocumentUtil.writeInRunUndoTransparentAction
effd774: svn: Refactored SvnCheckinEnvironment - use common client factory model for file status detection
c725668: Make BaseRepositoryImpl initialize HTTP client lazily on network settings updates
4af031a: svn: Refactored SvnCheckinEnvironment - not null, code simplifications, methods extracted, warnings fixes
81e72d4: + gruntfile
343a277: revert IDEA-120811
3e991eb: deprecate addCurrentToHistory, cleanup
b22e89b: continue LanguageConsoleBuilder.registerExecuteAction — don't force client to know low-level details, cleanup NewSshConsole
3936b51: add LanguageConsoleBuilder.registerExecuteAction — This API doesn't look good, but it is much better than force client to know low-level details
50318ce: IDEA-120906 NPE at com.intellij.ide.util.projectWizard.SdkSettingsStep.<init>
4524244: Slightly update message in "Option" tab of YouTrack repository editor
cdfd4d0: IDEA-116229 (Invalid Warning: Contents of array 'longs' are written to, but never read)
17dcc98: IDEA-120799 (Quick-fix for "Unnecessary parentheses" changes expression semantics)
0ced324: IDEA-120904 Debugger UI: watch variable text field is shown when debug tool window is hidden
5ed18af: Merge remote-tracking branch 'origin/master'
7d1d9c8: fixed PY-12185 Project interpreter: strange combobox size in settings
7039d82: store 'export to html' settings in workspace.xml instead of shared misc.xml (IDEA-96348)
a3a8fa7: Merge remote-tracking branch 'origin/master'
817df93: Merge remote-tracking branch 'origin/master'
5c95f86: another fix for PY-12186 Project interpreter: not able to select element in appeared settings menu
0c1316c: Merge remote-tracking branch 'origin/master'
ee07119: show word variants in custom file type completion autopopup
f5e8ce0: PathMacroMap: add clarifying comments about by-reference string comparison
f1ac105: use common ExceptionUtil
89e9ca0: do not loose type args on ratianalize static calls (IDEA-120767)
c7b78f7: IDEA-120784 "Class is public should be declared in a file named <Classname>.java" for inner interface
65642d9: IDEA-118305 github: try to fix GH:E specific bug
ada3f52: Merge remote-tracking branch 'origin/master'
3a9eef6: speed search
071a9d5: cleanup
2108e56: fix for PY-12186 Project interpreter: not able to select element in appeared settings menu
11069dc1: Merge remote-tracking branch 'origin/master'
6ec4b86: fixed PY-12184 Project Interpreter: Throwable at com.intellij.openapi.vfs.newvfs.RefreshQueueImpl.execute
08f79dc: diff: do not try to create empty LineFragment
f0eed8c: IDEA-80056 Column selection mode improvement
eec124a: IDEA-80056 Column selection mode improvement
81adc91: IDEA-120834 Same-class methods should be preferred over static imports
1ae2a82: IDEA-118234 Groovy 2.3: type inference of SAM-closure parameters
d0507fc: IDEA-120595 Restore compatibility with JIRA < 4.2. Return support of JIRA SOAP API. Move all JIRA related classes to dedicated module
0fcb597: Add tests for CertificatesManager. Disable them for now, because SNI related patch in httpclient works only on Oracle JRE 1.7+
3355e94: Update Apache HttpClient to 4.3.2 due to fix of HTTPCLIENT-1119
b2d5f76: svn: Refactored AbstractUpdateIntegrateCrawler - remove unnecessary SVNUpdateClient creation
e266021: svn: Refactored GatheringChangelistBuilder - make inherit EmptyChangelistBuilder, renames, optimizations
f042e76: svn: Refactored GatheringChangelistBuilder - use common client factory model to get svn properties (instead of direct SVNWCClient usage)
300839e: svn: Refactored GatheringChangelistBuilder - code simplifications, notnull, removed unused code
17b7bfa: svn: Make SvnKitBrowseClient not pass to handler separate entry for root folder (at which list() method was executed) - to have consistent behaviour for both CmdBrowseClient and SvnKitBrowseClient
c4e1a04f: svn: Implemented correct element name and relative path calculation for CmdBrowseClient
4d8ae08: svn: Refactored SvnChangeList - use common client factory model (instead of direct SVNLogClient usage)
05913e6: svn: Refactored SvnUtil.createUrl - make it throw SvnBindException (instead of SVNException)
8a44f01: svn: Refactored SvnChangeList - SVNRepository usages replaced with "svn info" command
a66c80b: svn: Refactored SvnChangeList - method extractions, code simplifications
56ca50d: svn: Ensure repository relative path is used in SvnChangeList logic (logic was broken and full path was returned after changes in commit 42c824)
58f70a1: svn: Refactored RemoteRevisionsNumberCache - code simplifications, warnings fixes
24e95a4: svn: Refactored SvnCommandLineInfoClient - code simplifications, warnings fixes
87bcdbd: svn: Refactored SvnChangeList - removed duplication, simplified code flow
Change-Id: I25aae09c68ce6c702066c108dae46d17c32e2709
Diffstat (limited to 'platform')
1326 files changed, 8337 insertions, 3687 deletions
diff --git a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java index adabfa0c37ea..dac770921aa5 100644 --- a/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java +++ b/platform/analysis-api/src/com/intellij/analysis/AnalysisScope.java @@ -19,7 +19,9 @@ package com.intellij.analysis; import com.intellij.codeInsight.FileModificationService; import com.intellij.codeInsight.daemon.ProblemHighlightFilter; import com.intellij.lang.injection.InjectedLanguageManager; +import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; @@ -365,13 +367,24 @@ public class AnalysisScope { @NotNull final PsiElementVisitor visitor, @NotNull final PsiManager psiManager, final boolean needReadAction) { - if (!fileOrDir.isValid()) return false; - final PsiFile file = getPsiFileInReadAction(psiManager, fileOrDir); - if (file == null){ - //skip .class files under src directory - return true; + final PsiFile file; + + AccessToken accessToken = ReadAction.start(); + try { + if (!fileOrDir.isValid()) return false; + + file = psiManager.findFile(fileOrDir); + if (file == null) { + //skip .class files under src directory + return true; + } + + if (!shouldHighlightFile(file)) return true; } - if (!shouldHighlightFile(file)) return true; + finally { + accessToken.finish(); + } + if (needReadAction) { PsiDocumentManager.getInstance(psiManager.getProject()).commitAndRunReadAction(new Runnable(){ @Override @@ -564,22 +577,6 @@ public class AnalysisScope { } } - private static PsiFile getPsiFileInReadAction(@NotNull final PsiManager psiManager, @NotNull final VirtualFile file) { - return ApplicationManager.getApplication().runReadAction(new Computable<PsiFile>() { - @Override - @Nullable - public PsiFile compute() { - if (file.isValid()) { - PsiFile psiFile = psiManager.findFile(file); - if (psiFile != null && psiFile.isValid()) { - return psiFile; - } - } - return null; - } - }); - } - public boolean containsSources(boolean isTest) { if (myElement != null) { final Project project = myElement.getProject(); diff --git a/platform/analysis-api/src/com/intellij/codeInspection/LocalQuickFix.java b/platform/analysis-api/src/com/intellij/codeInspection/LocalQuickFix.java index bd245cba4896..bf0a35c14983 100644 --- a/platform/analysis-api/src/com/intellij/codeInspection/LocalQuickFix.java +++ b/platform/analysis-api/src/com/intellij/codeInspection/LocalQuickFix.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. @@ -25,6 +25,7 @@ package com.intellij.codeInspection; * Instead, use the {@link ProblemDescriptor#getPsiElement()} * in {@link QuickFix#applyFix(com.intellij.openapi.project.Project, CommonProblemDescriptor)} * to retrieve the PSI context the fix will work on. + * See also {@link LocalQuickFixOnPsiElement} which uses {@link com.intellij.psi.SmartPsiElementPointer} instead of storing PSI elements. * * @author max * @see LocalQuickFixBase diff --git a/platform/analysis-api/src/com/intellij/lang/ExternalLanguageAnnotators.java b/platform/analysis-api/src/com/intellij/lang/ExternalLanguageAnnotators.java index 90bd7a13f89a..e47c15a6942d 100644 --- a/platform/analysis-api/src/com/intellij/lang/ExternalLanguageAnnotators.java +++ b/platform/analysis-api/src/com/intellij/lang/ExternalLanguageAnnotators.java @@ -24,6 +24,7 @@ import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.util.Condition; import com.intellij.psi.PsiFile; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -35,7 +36,7 @@ public class ExternalLanguageAnnotators extends LanguageExtension<ExternalAnnota super("com.intellij.externalAnnotator"); } - public static List<ExternalAnnotator> allForFile(Language language, final PsiFile file) { + public static List<ExternalAnnotator> allForFile(@NotNull Language language, @NotNull final PsiFile file) { List<ExternalAnnotator> annotators = INSTANCE.allForLanguage(language); final ExternalAnnotatorsFilter[] filters = Extensions.getExtensions(ExternalAnnotatorsFilter.EXTENSION_POINT_NAME); return ContainerUtil.findAll(annotators, new Condition<ExternalAnnotator>() { diff --git a/platform/core-api/src/com/intellij/lang/LanguageExtension.java b/platform/core-api/src/com/intellij/lang/LanguageExtension.java index 17a134c0cdb9..1ee631735259 100644 --- a/platform/core-api/src/com/intellij/lang/LanguageExtension.java +++ b/platform/core-api/src/com/intellij/lang/LanguageExtension.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,8 +41,9 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> { IN_LANGUAGE_CACHE = Key.create("EXTENSIONS_IN_LANGUAGE_"+epName); } + @NotNull @Override - protected String keyToString(final Language key) { + protected String keyToString(@NotNull final Language key) { return key.getID(); } @@ -66,7 +67,7 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> { } @NotNull - public List<T> allForLanguage(Language l) { + public List<T> allForLanguage(@NotNull Language l) { List<T> list = forKey(l); if (list.isEmpty()) { Language base = l.getBaseLanguage(); @@ -91,6 +92,7 @@ public class LanguageExtension<T> extends KeyedExtensionCollector<T, Language> { return myDefaultImplementation; } + @NotNull protected Key<T> getLanguageCache() { return IN_LANGUAGE_CACHE; } diff --git a/platform/core-api/src/com/intellij/lang/PsiBuilderUtil.java b/platform/core-api/src/com/intellij/lang/PsiBuilderUtil.java index f512528e8ea6..28bf519de3d3 100644 --- a/platform/core-api/src/com/intellij/lang/PsiBuilderUtil.java +++ b/platform/core-api/src/com/intellij/lang/PsiBuilderUtil.java @@ -17,6 +17,7 @@ package com.intellij.lang; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet; +import org.jetbrains.annotations.Nullable; public class PsiBuilderUtil { private PsiBuilderUtil() { } @@ -74,4 +75,15 @@ public class PsiBuilderUtil { if (marker != null) marker.drop(); } } + + /** + * Rolls the lexer back to position before given marker - if not null. + * + * @param marker marker to roll back to. + */ + public static void rollbackTo(@Nullable PsiBuilder.Marker marker) { + if (marker != null) { + marker.rollbackTo(); + } + } } diff --git a/platform/core-api/src/com/intellij/lang/folding/LanguageFolding.java b/platform/core-api/src/com/intellij/lang/folding/LanguageFolding.java index 579f84a049ac..4530ec081dc8 100644 --- a/platform/core-api/src/com/intellij/lang/folding/LanguageFolding.java +++ b/platform/core-api/src/com/intellij/lang/folding/LanguageFolding.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.editor.Document; import com.intellij.openapi.project.DumbService; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; @@ -72,7 +73,8 @@ public class LanguageFolding extends LanguageExtension<FoldingBuilder> { : Collections.singletonList(result); } - public static FoldingDescriptor[] buildFoldingDescriptors(FoldingBuilder builder, PsiElement root, Document document, boolean quick) { + @NotNull + public static FoldingDescriptor[] buildFoldingDescriptors(@Nullable FoldingBuilder builder, @NotNull PsiElement root, @NotNull Document document, boolean quick) { if (!DumbService.isDumbAware(builder) && DumbService.getInstance(root.getProject()).isDumb()) { return FoldingDescriptor.EMPTY; } diff --git a/platform/core-api/src/com/intellij/navigation/ItemPresentationProvider.java b/platform/core-api/src/com/intellij/navigation/ItemPresentationProvider.java index 44e4dbde6cb3..3f35f7f0c415 100644 --- a/platform/core-api/src/com/intellij/navigation/ItemPresentationProvider.java +++ b/platform/core-api/src/com/intellij/navigation/ItemPresentationProvider.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. @@ -15,9 +15,11 @@ */ package com.intellij.navigation; +import org.jetbrains.annotations.NotNull; + /** * @author yole */ public interface ItemPresentationProvider<T extends NavigationItem> { - ItemPresentation getPresentation(T item); + ItemPresentation getPresentation(@NotNull T item); } diff --git a/platform/core-api/src/com/intellij/navigation/ItemPresentationProviders.java b/platform/core-api/src/com/intellij/navigation/ItemPresentationProviders.java index 7761382ecc44..95ff33b9d679 100644 --- a/platform/core-api/src/com/intellij/navigation/ItemPresentationProviders.java +++ b/platform/core-api/src/com/intellij/navigation/ItemPresentationProviders.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,8 +36,8 @@ public class ItemPresentationProviders extends ClassExtension<ItemPresentationPr } @Nullable - public static ItemPresentation getItemPresentation(NavigationItem element) { + public static ItemPresentation getItemPresentation(@NotNull NavigationItem element) { final ItemPresentationProvider<NavigationItem> provider = getItemPresentationProvider(element); - return provider != null ? provider.getPresentation(element) : null; + return provider == null ? null : provider.getPresentation(element); } } diff --git a/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java b/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java index d868b99c8585..2c5a9d93cbef 100644 --- a/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java +++ b/platform/core-api/src/com/intellij/openapi/editor/colors/ColorKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.openapi.editor.colors; import com.intellij.openapi.diagnostic.Logger; import com.intellij.ui.Gray; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.awt.*; import java.util.HashMap; @@ -31,7 +32,7 @@ public final class ColorKey implements Comparable<ColorKey> { private Color myDefaultColor = NULL_COLOR; private static final Map<String, ColorKey> ourRegistry = new HashMap<String, ColorKey>(); - private ColorKey(String externalName) { + private ColorKey(@NotNull String externalName) { myExternalName = externalName; if (ourRegistry.containsKey(myExternalName)) { LOG.error("Key " + myExternalName + " already registered."); @@ -41,20 +42,23 @@ public final class ColorKey implements Comparable<ColorKey> { } } - public static ColorKey find(String externalName) { + @NotNull + public static ColorKey find(@NotNull String externalName) { ColorKey key = ourRegistry.get(externalName); - return key != null ? key : new ColorKey(externalName); + return key == null ? new ColorKey(externalName) : key; } public String toString() { return myExternalName; } + @NotNull public String getExternalName() { return myExternalName; } - public int compareTo(ColorKey key) { + @Override + public int compareTo(@NotNull ColorKey key) { return myExternalName.compareTo(key.myExternalName); } @@ -72,15 +76,14 @@ public final class ColorKey implements Comparable<ColorKey> { return myDefaultColor; } - public static ColorKey createColorKey(@NonNls String externalName) { + @NotNull + public static ColorKey createColorKey(@NonNls @NotNull String externalName) { return find(externalName); } - public static ColorKey createColorKey(@NonNls String externalName, Color defaultColor) { - ColorKey key = ourRegistry.get(externalName); - if (key == null) { - key = find(externalName); - } + @NotNull + public static ColorKey createColorKey(@NonNls @NotNull String externalName, Color defaultColor) { + ColorKey key = createColorKey(externalName); if (key.getDefaultColor() == null) { key.myDefaultColor = defaultColor; diff --git a/platform/core-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java b/platform/core-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java index 2d9825df0102..1f410be5cf7b 100644 --- a/platform/core-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java +++ b/platform/core-api/src/com/intellij/openapi/fileEditor/FileDocumentManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,5 +70,5 @@ public abstract class FileDocumentManager implements SavingRequestor { return getInstance().requestWriting(document, project); } - public abstract void reloadFiles(VirtualFile... files); + public abstract void reloadFiles(@NotNull VirtualFile... files); } diff --git a/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtension.java b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtension.java index d66b9215db57..f2898eb5f2fc 100644 --- a/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtension.java +++ b/platform/core-api/src/com/intellij/openapi/fileTypes/FileTypeExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.openapi.fileTypes; import com.intellij.openapi.util.KeyedExtensionCollector; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.util.List; @@ -29,22 +30,19 @@ public class FileTypeExtension<T> extends KeyedExtensionCollector<T, FileType> { super(epName); } + @NotNull @Override - protected String keyToString(final FileType key) { + protected String keyToString(@NotNull final FileType key) { return key.getName(); } - public List<T> allForFileType(FileType t) { + @NotNull + public List<T> allForFileType(@NotNull FileType t) { return forKey(t); } - public T forFileType(FileType t) { + public T forFileType(@NotNull FileType t) { final List<T> all = allForFileType(t); - if (all.isEmpty()) { - return null; - } - else { - return all.get(0); - } + return all.isEmpty() ? null : all.get(0); } }
\ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/openapi/util/ActiveRunnable.java b/platform/core-api/src/com/intellij/openapi/util/ActiveRunnable.java index f3b5e59d34e3..96e5630d1e5c 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/ActiveRunnable.java +++ b/platform/core-api/src/com/intellij/openapi/util/ActiveRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/openapi/util/BusyObject.java b/platform/core-api/src/com/intellij/openapi/util/BusyObject.java index 1343eac3745f..915bc15d7224 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/BusyObject.java +++ b/platform/core-api/src/com/intellij/openapi/util/BusyObject.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. @@ -26,6 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger; public interface BusyObject { + @NotNull ActionCallback getReady(@NotNull Object requestor); abstract class Impl implements BusyObject { @@ -66,9 +67,7 @@ public interface BusyObject { if (isReady()) { return new ActionCallback.Done(); } - else { - return addReadyCallback(requestor); - } + return addReadyCallback(requestor); } @NotNull @@ -84,6 +83,7 @@ public interface BusyObject { } } + @NotNull private ActionCallback[] getReadyCallbacks() { synchronized (myReadyCallbacks) { ActionCallback[] result = myReadyCallbacks.values().toArray(new ActionCallback[myReadyCallbacks.size()]); @@ -92,6 +92,7 @@ public interface BusyObject { } } + @NotNull private Pair<ActionCallback, List<ActionCallback>> getReadyCallbacks(Object readyRequestor) { synchronized (myReadyCallbacks) { ActionCallback done = myReadyCallbacks.get(readyRequestor); diff --git a/platform/core-api/src/com/intellij/openapi/util/ClassExtension.java b/platform/core-api/src/com/intellij/openapi/util/ClassExtension.java index 68720c361458..f46207140935 100644 --- a/platform/core-api/src/com/intellij/openapi/util/ClassExtension.java +++ b/platform/core-api/src/com/intellij/openapi/util/ClassExtension.java @@ -21,6 +21,7 @@ package com.intellij.openapi.util; import gnu.trove.THashSet; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -31,19 +32,21 @@ public class ClassExtension<T> extends KeyedExtensionCollector<T, Class> { super(epName); } + @NotNull @Override - protected String keyToString(final Class key) { + protected String keyToString(@NotNull final Class key) { return key.getName(); } + @NotNull @Override - protected List<T> buildExtensions(final String key, final Class classKey) { + protected List<T> buildExtensions(@NotNull final String key, @NotNull final Class classKey) { final Set<String> allSupers = new THashSet<String>(); collectSupers(classKey, allSupers); return buildExtensions(allSupers); } - private static void collectSupers(Class classKey, Set<String> allSupers) { + private static void collectSupers(@NotNull Class classKey, @NotNull Set<String> allSupers) { allSupers.add(classKey.getName()); final Class[] interfaces = classKey.getInterfaces(); for (final Class anInterface : interfaces) { @@ -57,7 +60,7 @@ public class ClassExtension<T> extends KeyedExtensionCollector<T, Class> { } @Nullable - public T forClass(Class t) { + public T forClass(@NotNull Class t) { final List<T> ts = forKey(t); return ts.isEmpty() ? null : ts.get(0); } diff --git a/platform/core-api/src/com/intellij/openapi/util/KeyedExtensionCollector.java b/platform/core-api/src/com/intellij/openapi/util/KeyedExtensionCollector.java index 6e4549edd380..c5937de737d7 100644 --- a/platform/core-api/src/com/intellij/openapi/util/KeyedExtensionCollector.java +++ b/platform/core-api/src/com/intellij/openapi/util/KeyedExtensionCollector.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 class KeyedExtensionCollector<T, KeyT> { private ExtensionPointAndAreaListener<KeyedLazyInstance<T>> myListener; private final List<ExtensionPointListener<T>> myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); - public KeyedExtensionCollector(@NonNls String epName) { + public KeyedExtensionCollector(@NonNls @NotNull String epName) { myEpName = epName; lock = new String("lock for KeyedExtensionCollector " + epName); resetAreaListener(); @@ -67,7 +67,7 @@ public class KeyedExtensionCollector<T, KeyT> { } } - public void addExplicitExtension(KeyT key, T t) { + public void addExplicitExtension(@NotNull KeyT key, @NotNull T t) { synchronized (lock) { final String skey = keyToString(key); List<T> list = myExplicitExtensions.get(skey); @@ -83,7 +83,7 @@ public class KeyedExtensionCollector<T, KeyT> { } } - public void removeExplicitExtension(KeyT key, T t) { + public void removeExplicitExtension(@NotNull KeyT key, @NotNull T t) { synchronized (lock) { final String skey = keyToString(key); List<T> list = myExplicitExtensions.get(skey); @@ -97,7 +97,8 @@ public class KeyedExtensionCollector<T, KeyT> { } } - protected String keyToString(KeyT key) { + @NotNull + protected String keyToString(@NotNull KeyT key) { return key.toString(); } @@ -105,7 +106,7 @@ public class KeyedExtensionCollector<T, KeyT> { * @see #findSingle(Object) */ @NotNull - public List<T> forKey(KeyT key) { + public List<T> forKey(@NotNull KeyT key) { final String stringKey = keyToString(key); List<T> cache = myCache.get(stringKey); if (cache != null) return cache; @@ -115,16 +116,18 @@ public class KeyedExtensionCollector<T, KeyT> { return cache; } - public T findSingle(KeyT key) { + public T findSingle(@NotNull KeyT key) { List<T> list = forKey(key); return list.isEmpty() ? null : list.get(0); } - protected List<T> buildExtensions(final String stringKey, final KeyT key) { + @NotNull + protected List<T> buildExtensions(@NotNull String stringKey, @NotNull KeyT key) { return buildExtensions(Collections.singleton(stringKey)); } - protected final List<T> buildExtensions(Set<String> keys) { + @NotNull + protected final List<T> buildExtensions(@NotNull Set<String> keys) { synchronized (lock) { List<T> result = null; for (Map.Entry<String, List<T>> entry : myExplicitExtensions.entrySet()) { @@ -175,10 +178,11 @@ public class KeyedExtensionCollector<T, KeyT> { @Nullable private ExtensionPoint<KeyedLazyInstance<T>> getPoint() { - if (myPoint == null) { + ExtensionPoint<KeyedLazyInstance<T>> point = myPoint; + if (point == null) { if (Extensions.getRootArea().hasExtensionPoint(myEpName)) { ExtensionPointName<KeyedLazyInstance<T>> typesafe = ExtensionPointName.create(myEpName); - myPoint = Extensions.getRootArea().getExtensionPoint(typesafe); + myPoint = point = Extensions.getRootArea().getExtensionPoint(typesafe); myListener = new ExtensionPointAndAreaListener<KeyedLazyInstance<T>>() { @Override public void extensionAdded(@NotNull final KeyedLazyInstance<T> bean, @Nullable final PluginDescriptor pluginDescriptor) { @@ -214,10 +218,10 @@ public class KeyedExtensionCollector<T, KeyT> { } }; - myPoint.addExtensionPointListener(myListener); + point.addExtensionPointListener(myListener); } } - return myPoint; + return point; } public boolean hasAnyExtensions() { diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileAdapter.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileAdapter.java index 10898503424c..44998e6dba0e 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileAdapter.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileAdapter.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,45 +15,47 @@ */ package com.intellij.openapi.vfs; +import org.jetbrains.annotations.NotNull; + public abstract class VirtualFileAdapter implements VirtualFileListener { @Override - public void propertyChanged(VirtualFilePropertyEvent event){ + public void propertyChanged(@NotNull VirtualFilePropertyEvent event){ } @Override - public void contentsChanged(VirtualFileEvent event){ + public void contentsChanged(@NotNull VirtualFileEvent event){ } @Override - public void fileCreated(VirtualFileEvent event){ + public void fileCreated(@NotNull VirtualFileEvent event){ } @Override - public void fileDeleted(VirtualFileEvent event){ + public void fileDeleted(@NotNull VirtualFileEvent event){ } @Override - public void fileMoved(VirtualFileMoveEvent event){ + public void fileMoved(@NotNull VirtualFileMoveEvent event){ } @Override - public void fileCopied(VirtualFileCopyEvent event) { + public void fileCopied(@NotNull VirtualFileCopyEvent event) { fileCreated(event); } @Override - public void beforePropertyChange(VirtualFilePropertyEvent event){ + public void beforePropertyChange(@NotNull VirtualFilePropertyEvent event){ } @Override - public void beforeContentsChange(VirtualFileEvent event){ + public void beforeContentsChange(@NotNull VirtualFileEvent event){ } @Override - public void beforeFileDeletion(VirtualFileEvent event){ + public void beforeFileDeletion(@NotNull VirtualFileEvent event){ } @Override - public void beforeFileMovement(VirtualFileMoveEvent event){ + public void beforeFileMovement(@NotNull VirtualFileMoveEvent event){ } } diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileListener.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileListener.java index f24f52e88212..002070e0243e 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileListener.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,6 +15,8 @@ */ package com.intellij.openapi.vfs; +import org.jetbrains.annotations.NotNull; + import java.util.EventListener; /** @@ -30,68 +32,68 @@ public interface VirtualFileListener extends EventListener { * * @param event the event object containing information about the change. */ - void propertyChanged(VirtualFilePropertyEvent event); + void propertyChanged(@NotNull VirtualFilePropertyEvent event); /** * Fired when the contents of a virtual file is changed. * * @param event the event object containing information about the change. */ - void contentsChanged(VirtualFileEvent event); + void contentsChanged(@NotNull VirtualFileEvent event); /** * Fired when a virtual file is created. This event is not fired for files discovered during initial VFS initialization. * * @param event the event object containing information about the change. */ - void fileCreated(VirtualFileEvent event); + void fileCreated(@NotNull VirtualFileEvent event); /** * Fired when a virtual file is deleted. * * @param event the event object containing information about the change. */ - void fileDeleted(VirtualFileEvent event); + void fileDeleted(@NotNull VirtualFileEvent event); /** * Fired when a virtual file is moved from within IDEA. * * @param event the event object containing information about the change. */ - void fileMoved(VirtualFileMoveEvent event); + void fileMoved(@NotNull VirtualFileMoveEvent event); /** * Fired when a virtual file is copied from within IDEA. * * @param event the event object containing information about the change. */ - void fileCopied(VirtualFileCopyEvent event); + void fileCopied(@NotNull VirtualFileCopyEvent event); /** * Fired before the change of a name or writable status of a file is processed. * * @param event the event object containing information about the change. */ - void beforePropertyChange(VirtualFilePropertyEvent event); + void beforePropertyChange(@NotNull VirtualFilePropertyEvent event); /** * Fired before the change of contents of a file is processed. * * @param event the event object containing information about the change. */ - void beforeContentsChange(VirtualFileEvent event); + void beforeContentsChange(@NotNull VirtualFileEvent event); /** * Fired before the deletion of a file is processed. * * @param event the event object containing information about the change. */ - void beforeFileDeletion(VirtualFileEvent event); + void beforeFileDeletion(@NotNull VirtualFileEvent event); /** * Fired before the movement of a file is processed. * * @param event the event object containing information about the change. */ - void beforeFileMovement(VirtualFileMoveEvent event); + void beforeFileMovement(@NotNull VirtualFileMoveEvent event); } diff --git a/platform/core-api/src/com/intellij/openapi/vfs/impl/BulkVirtualFileListenerAdapter.java b/platform/core-api/src/com/intellij/openapi/vfs/impl/BulkVirtualFileListenerAdapter.java index 077fa0ffb2b9..23bddb33849a 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/impl/BulkVirtualFileListenerAdapter.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/impl/BulkVirtualFileListenerAdapter.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. @@ -58,7 +58,7 @@ public class BulkVirtualFileListenerAdapter implements BulkFileListener { } } - public static void fireAfter(VirtualFileListener adapted, final VFileEvent event) { + public static void fireAfter(@NotNull VirtualFileListener adapted, @NotNull VFileEvent event) { if (event instanceof VFileContentChangeEvent) { final VFileContentChangeEvent ce = (VFileContentChangeEvent)event; final VirtualFile file = ce.getFile(); @@ -95,7 +95,7 @@ public class BulkVirtualFileListenerAdapter implements BulkFileListener { } } - public static void fireBefore(VirtualFileListener adapted, final VFileEvent event) { + public static void fireBefore(@NotNull VirtualFileListener adapted, @NotNull VFileEvent event) { if (event instanceof VFileContentChangeEvent) { final VFileContentChangeEvent ce = (VFileContentChangeEvent)event; final VirtualFile file = ce.getFile(); diff --git a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileContentChangeEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileContentChangeEvent.java index 85a991cd9278..cc1614c16ecd 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileContentChangeEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileContentChangeEvent.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. @@ -90,8 +90,7 @@ public class VFileContentChangeEvent extends VFileEvent { } public int hashCode() { - int result; - result = myFile.hashCode(); + int result = myFile.hashCode(); result = 31 * result + (int)(myOldModificationStamp ^ (myOldModificationStamp >>> 32)); result = 31 * result + (int)(myNewModificationStamp ^ (myNewModificationStamp >>> 32)); return result; diff --git a/platform/core-api/src/com/intellij/patterns/StandardPatterns.java b/platform/core-api/src/com/intellij/patterns/StandardPatterns.java index 0a1dc14a7c9d..8a157509109b 100644 --- a/platform/core-api/src/com/intellij/patterns/StandardPatterns.java +++ b/platform/core-api/src/com/intellij/patterns/StandardPatterns.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,8 @@ import java.util.List; @SuppressWarnings("unchecked") public class StandardPatterns { + private static final FalsePattern FALSE_PATTERN = new FalsePattern(); + public static StringPattern string() { return new StringPattern(); } @@ -178,4 +180,30 @@ public class StandardPatterns { }); } + + public static <E> ElementPattern<E> alwaysFalse() { + return FALSE_PATTERN; + } + + private static final class FalsePattern implements ElementPattern { + @Override + public boolean accepts(@Nullable Object o) { + return false; + } + + @Override + public boolean accepts(@Nullable Object o, ProcessingContext context) { + return false; + } + + @Override + public ElementPatternCondition getCondition() { + return new ElementPatternCondition(new InitialPatternCondition(Object.class) { + @Override + public boolean accepts(@Nullable Object o, ProcessingContext context) { + return false; + } + }); + } + } } diff --git a/platform/core-api/src/com/intellij/psi/ElementManipulator.java b/platform/core-api/src/com/intellij/psi/ElementManipulator.java index 1feac43c7498..15127f8c24ae 100644 --- a/platform/core-api/src/com/intellij/psi/ElementManipulator.java +++ b/platform/core-api/src/com/intellij/psi/ElementManipulator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.psi; import com.intellij.openapi.util.TextRange; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; /** * Created by IntelliJ IDEA. @@ -38,9 +39,10 @@ public interface ElementManipulator<T extends PsiElement> { * @return changed element * @throws IncorrectOperationException if something goes wrong */ - T handleContentChange(T element, TextRange range, String newContent) throws IncorrectOperationException; + T handleContentChange(@NotNull T element, @NotNull TextRange range, String newContent) throws IncorrectOperationException; - T handleContentChange(T element, String newContent) throws IncorrectOperationException; + T handleContentChange(@NotNull T element, String newContent) throws IncorrectOperationException; - TextRange getRangeInElement(T element); + @NotNull + TextRange getRangeInElement(@NotNull T element); } diff --git a/platform/core-api/src/com/intellij/psi/ElementManipulators.java b/platform/core-api/src/com/intellij/psi/ElementManipulators.java index 24203c3c82cb..886e22e26d33 100644 --- a/platform/core-api/src/com/intellij/psi/ElementManipulators.java +++ b/platform/core-api/src/com/intellij/psi/ElementManipulators.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,19 +49,20 @@ public class ElementManipulators extends ClassExtension<ElementManipulator> { return manipulator.getRangeInElement(element).getStartOffset(); } - public static <T extends PsiElement> ElementManipulator<T> getNotNullManipulator(T element) { + @NotNull + public static <T extends PsiElement> ElementManipulator<T> getNotNullManipulator(@NotNull T element) { final ElementManipulator<T> manipulator = getManipulator(element); LOG.assertTrue(manipulator != null, element.getClass().getName()); return manipulator; } - public static TextRange getValueTextRange(final PsiElement element) { + public static TextRange getValueTextRange(@NotNull PsiElement element) { final ElementManipulator<PsiElement> manipulator = getManipulator(element); return manipulator == null ? TextRange.from(0, element.getTextLength()) : manipulator.getRangeInElement(element); } @NotNull - public static String getValueText(final PsiElement element) { + public static String getValueText(@NotNull PsiElement element) { final TextRange valueTextRange = getValueTextRange(element); if (valueTextRange.isEmpty()) return ""; @@ -73,7 +74,7 @@ public class ElementManipulators extends ClassExtension<ElementManipulator> { return valueTextRange.substring(text); } - public static <T extends PsiElement> T handleContentChange(T element, String text) { + public static <T extends PsiElement> T handleContentChange(@NotNull T element, String text) { final ElementManipulator<T> manipulator = getNotNullManipulator(element); return manipulator.handleContentChange(element, text); } diff --git a/platform/core-api/src/com/intellij/psi/FileTypeFileViewProviders.java b/platform/core-api/src/com/intellij/psi/FileTypeFileViewProviders.java index 03f7e570dc74..f75b60dc155c 100644 --- a/platform/core-api/src/com/intellij/psi/FileTypeFileViewProviders.java +++ b/platform/core-api/src/com/intellij/psi/FileTypeFileViewProviders.java @@ -22,7 +22,7 @@ package com.intellij.psi; import com.intellij.openapi.fileTypes.FileTypeExtension; public class FileTypeFileViewProviders extends FileTypeExtension<FileViewProviderFactory> { - public static FileTypeFileViewProviders INSTANCE = new FileTypeFileViewProviders(); + public static final FileTypeFileViewProviders INSTANCE = new FileTypeFileViewProviders(); private FileTypeFileViewProviders() { super("com.intellij.fileType.fileViewProviderFactory"); diff --git a/platform/core-api/src/com/intellij/psi/FileViewProviderFactory.java b/platform/core-api/src/com/intellij/psi/FileViewProviderFactory.java index 4fe3ecdaae78..60fdf43dad58 100644 --- a/platform/core-api/src/com/intellij/psi/FileViewProviderFactory.java +++ b/platform/core-api/src/com/intellij/psi/FileViewProviderFactory.java @@ -26,5 +26,5 @@ import org.jetbrains.annotations.NotNull; * @author yole */ public interface FileViewProviderFactory { - FileViewProvider createFileViewProvider(@NotNull VirtualFile file, Language language, @NotNull PsiManager manager, boolean physical); + FileViewProvider createFileViewProvider(@NotNull VirtualFile file, Language language, @NotNull PsiManager manager, boolean eventSystemEnabled); }
\ No newline at end of file diff --git a/platform/core-api/src/com/intellij/psi/PsiFileFactory.java b/platform/core-api/src/com/intellij/psi/PsiFileFactory.java index b96a0fbddba9..b31c03b6640a 100644 --- a/platform/core-api/src/com/intellij/psi/PsiFileFactory.java +++ b/platform/core-api/src/com/intellij/psi/PsiFileFactory.java @@ -55,19 +55,19 @@ public abstract class PsiFileFactory { @NotNull public abstract PsiFile createFileFromText(@NonNls @NotNull String name, @NotNull FileType fileType, @NotNull CharSequence text, - long modificationStamp, boolean physical); + long modificationStamp, boolean eventSystemEnabled); @NotNull public abstract PsiFile createFileFromText(@NonNls @NotNull String name, @NotNull FileType fileType, @NotNull CharSequence text, - long modificationStamp, boolean physical, boolean markAsCopy); + long modificationStamp, boolean eventSystemEnabled, boolean markAsCopy); public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text); public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text, - boolean physical, boolean markAsCopy); + boolean eventSystemEnabled, boolean markAsCopy); public abstract PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text, - boolean physical, boolean markAsCopy, boolean noSizeLimit); + boolean eventSystemEnabled, boolean markAsCopy, boolean noSizeLimit); public abstract PsiFile createFileFromText(FileType fileType, String fileName, CharSequence chars, int startOffset, int endOffset); diff --git a/platform/core-api/src/com/intellij/psi/PsiManager.java b/platform/core-api/src/com/intellij/psi/PsiManager.java index 2ed2c9c1e8ab..0df4b80daf25 100644 --- a/platform/core-api/src/com/intellij/psi/PsiManager.java +++ b/platform/core-api/src/com/intellij/psi/PsiManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,7 +100,7 @@ public abstract class PsiManager extends UserDataHolderBase { * @param listener the listener instance. * @param parentDisposable object, after whose disposing the listener should be removed */ - public abstract void addPsiTreeChangeListener(@NotNull PsiTreeChangeListener listener, Disposable parentDisposable); + public abstract void addPsiTreeChangeListener(@NotNull PsiTreeChangeListener listener, @NotNull Disposable parentDisposable); /** * Removes a listener for receiving notifications about all changes in the PSI tree of the project. diff --git a/platform/lang-api/src/com/intellij/psi/tree/package.html b/platform/core-api/src/com/intellij/psi/tree/package.html index 31767f5f343b..31767f5f343b 100644 --- a/platform/lang-api/src/com/intellij/psi/tree/package.html +++ b/platform/core-api/src/com/intellij/psi/tree/package.html diff --git a/platform/core-api/src/com/intellij/psi/util/PsiMatcherImpl.java b/platform/core-api/src/com/intellij/psi/util/PsiMatcherImpl.java deleted file mode 100644 index 2f79c28127c0..000000000000 --- a/platform/core-api/src/com/intellij/psi/util/PsiMatcherImpl.java +++ /dev/null @@ -1,119 +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; - -import com.intellij.psi.PsiElement; - -public class PsiMatcherImpl implements PsiMatcher { - private PsiElement myElement; - - public PsiMatcherImpl(PsiElement element) { - myElement = element; - } - - @Override - public PsiMatcher parent(PsiMatcherExpression e) { - myElement = myElement.getParent(); - if (myElement == null || e != null && e.match(myElement) != Boolean.TRUE) return NullPsiMatcherImpl.INSTANCE; - return this; - } - - @Override - public PsiMatcher firstChild(PsiMatcherExpression e) { - final PsiElement[] children = myElement.getChildren(); - for (PsiElement child : children) { - myElement = child; - if (e == null || e.match(myElement) == Boolean.TRUE) { - return this; - } - } - return NullPsiMatcherImpl.INSTANCE; - } - - @Override - public PsiMatcher ancestor(PsiMatcherExpression e) { - while (myElement != null) { - Boolean res = e == null ? Boolean.TRUE : e.match(myElement); - if (res == Boolean.TRUE) break; - if (res == null) return NullPsiMatcherImpl.INSTANCE; - myElement = myElement.getParent(); - } - if (myElement == null) return NullPsiMatcherImpl.INSTANCE; - return this; - } - - @Override - public PsiMatcher descendant(PsiMatcherExpression e) { - final PsiElement[] children = myElement.getChildren(); - for (PsiElement child : children) { - myElement = child; - final Boolean res = e == null ? Boolean.TRUE : e.match(myElement); - if (res == Boolean.TRUE) { - return this; - } - else if (res == Boolean.FALSE) { - final PsiMatcher grandChild = descendant(e); - if (grandChild != NullPsiMatcherImpl.INSTANCE) return grandChild; - } - } - return NullPsiMatcherImpl.INSTANCE; - } - - @Override - public PsiMatcher dot(PsiMatcherExpression e) { - return e == null || e.match(myElement) == Boolean.TRUE ? this : NullPsiMatcherImpl.INSTANCE; - } - - - @Override - public PsiElement getElement() { - return myElement; - } - - private static class NullPsiMatcherImpl implements PsiMatcher { - @Override - public PsiMatcher parent(PsiMatcherExpression e) { - return this; - } - - @Override - public PsiMatcher firstChild(PsiMatcherExpression e) { - return this; - } - - @Override - public PsiMatcher ancestor(PsiMatcherExpression e) { - return this; - } - - @Override - public PsiMatcher descendant(PsiMatcherExpression e) { - return this; - } - - @Override - public PsiMatcher dot(PsiMatcherExpression e) { - return this; - } - - @Override - public PsiElement getElement() { - return null; - } - - private static final NullPsiMatcherImpl INSTANCE = new NullPsiMatcherImpl(); - } -} diff --git a/platform/core-api/src/com/intellij/psi/util/PsiMatchers.java b/platform/core-api/src/com/intellij/psi/util/PsiMatchers.java deleted file mode 100644 index 61b45080a4b3..000000000000 --- a/platform/core-api/src/com/intellij/psi/util/PsiMatchers.java +++ /dev/null @@ -1,83 +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.util; - -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiNamedElement; -import com.intellij.util.ArrayUtil; -import org.jetbrains.annotations.NotNull; - -public class PsiMatchers { - - private PsiMatchers() { - } - - public static PsiMatcherExpression hasName(final String name) { - return new PsiMatcherExpression() { - @Override - public Boolean match(PsiElement element) { - if (element instanceof PsiNamedElement && name.equals(((PsiNamedElement) element).getName())) return Boolean.TRUE; - return Boolean.FALSE; - } - }; - } - - public static PsiMatcherExpression hasText(final String text) { - return new PsiMatcherExpression() { - @Override - public Boolean match(PsiElement element) { - if (element.getTextLength() != text.length()) return Boolean.FALSE; - return text.equals(element.getText()); - } - }; - } - - public static PsiMatcherExpression hasText(@NotNull final String... texts) { - return new PsiMatcherExpression() { - @Override - public Boolean match(PsiElement element) { - String text = element.getText(); - return ArrayUtil.find(texts, text) != -1; - } - }; - } - - public static PsiMatcherExpression hasClass(final Class aClass) { - return new PsiMatcherExpression() { - @Override - public Boolean match(PsiElement element) { - if (aClass.isAssignableFrom(element.getClass())) return Boolean.TRUE; - return Boolean.FALSE; - } - }; - } - - public static PsiMatcherExpression hasClass(final Class... classes) { - return new PsiMatcherExpression() { - @Override - public Boolean match(PsiElement element) { - for (Class aClass : classes) { - if (aClass.isAssignableFrom(element.getClass())) return Boolean.TRUE; - } - return Boolean.FALSE; - } - }; - } -} diff --git a/platform/core-api/src/com/intellij/psi/util/QualifiedName.java b/platform/core-api/src/com/intellij/psi/util/QualifiedName.java index cd96e5438424..7ff4f7c4fd2a 100644 --- a/platform/core-api/src/com/intellij/psi/util/QualifiedName.java +++ b/platform/core-api/src/com/intellij/psi/util/QualifiedName.java @@ -201,4 +201,8 @@ public class QualifiedName { public int hashCode() { return myComponents.hashCode(); } + + public QualifiedName subQualifiedName(int fromIndex, int toIndex) { + return fromComponents(myComponents.subList(fromIndex, toIndex)); + } } diff --git a/platform/platform-api/src/com/intellij/ui/SimpleTextAttributes.java b/platform/core-api/src/com/intellij/ui/SimpleTextAttributes.java index a77827b01aec..6046a0ec108c 100644 --- a/platform/platform-api/src/com/intellij/ui/SimpleTextAttributes.java +++ b/platform/core-api/src/com/intellij/ui/SimpleTextAttributes.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. @@ -59,7 +59,7 @@ public final class SimpleTextAttributes { public static final SimpleTextAttributes GRAY_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, Color.GRAY); public static final SimpleTextAttributes GRAY_ITALIC_ATTRIBUTES = new SimpleTextAttributes(STYLE_ITALIC, Color.GRAY); public static final SimpleTextAttributes DARK_TEXT = new SimpleTextAttributes(STYLE_PLAIN, new Color(112, 112, 164)); - public static final SimpleTextAttributes SIMPLE_CELL_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, UIUtil.getListForeground()); + public static final SimpleTextAttributes SIMPLE_CELL_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, new JBColor(Gray._0, Gray._187)); public static final SimpleTextAttributes SELECTED_SIMPLE_CELL_ATTRIBUTES = new SimpleTextAttributes(STYLE_PLAIN, UIUtil.getListSelectionForeground()); public static final SimpleTextAttributes EXCLUDED_ATTRIBUTES = new SimpleTextAttributes(STYLE_ITALIC, Color.GRAY); @@ -74,7 +74,7 @@ public final class SimpleTextAttributes { private final int myStyle; /** - * @param style style of the text fragment. + * @param style style of the text fragment. 5 * @param fgColor color of the text fragment. <code>color</code> can be * <code>null</code>. In that case <code>SimpleColoredComponent</code> will * use its foreground to paint the text fragment. diff --git a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java index 60560a349f95..8a46c4ed7076 100644 --- a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java +++ b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.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. @@ -79,7 +79,7 @@ public class CoreApplicationEnvironment { protected final VirtualFileSystem myJarFileSystem; private final Disposable myParentDisposable; - public CoreApplicationEnvironment(Disposable parentDisposable) { + public CoreApplicationEnvironment(@NotNull Disposable parentDisposable) { myParentDisposable = parentDisposable; Extensions.cleanRootArea(myParentDisposable); @@ -127,18 +127,21 @@ public class CoreApplicationEnvironment { myApplication.registerService(JobLauncher.class, createJobLauncher()); } - public <T> void registerApplicationService(Class<T> serviceInterface, T serviceImplementation) { + public <T> void registerApplicationService(@NotNull Class<T> serviceInterface, @NotNull T serviceImplementation) { myApplication.registerService(serviceInterface, serviceImplementation); } + @NotNull protected VirtualFilePointerManager createVirtualFilePointerManager() { return new CoreVirtualFilePointerManager(); } - protected MockApplication createApplication(Disposable parentDisposable) { + @NotNull + protected MockApplication createApplication(@NotNull Disposable parentDisposable) { return new MockApplicationEx(parentDisposable); } + @NotNull protected JobLauncher createJobLauncher() { return new JobLauncher() { @Override @@ -215,6 +218,7 @@ public class CoreApplicationEnvironment { }; } + @NotNull protected ProgressIndicatorProvider createProgressIndicatorProvider() { return new ProgressIndicatorProvider() { @Override @@ -233,14 +237,17 @@ public class CoreApplicationEnvironment { }; } + @NotNull protected VirtualFileSystem createJarFileSystem() { return new CoreJarFileSystem(); } + @NotNull protected CoreLocalFileSystem createLocalFileSystem() { return new CoreLocalFileSystem(); } + @NotNull public MockApplication getApplication() { return myApplication; } @@ -280,7 +287,7 @@ public class CoreApplicationEnvironment { addExplicitExtension(LanguageParserDefinitions.INSTANCE, language, parserDefinition); } - public <T> void addExplicitExtension(final FileTypeExtension<T> instance, final FileType fileType, final T object) { + public <T> void addExplicitExtension(@NotNull final FileTypeExtension<T> instance, @NotNull final FileType fileType, @NotNull final T object) { instance.addExplicitExtension(fileType, object); Disposer.register(myParentDisposable, new Disposable() { @Override diff --git a/platform/core-impl/src/com/intellij/core/CoreProjectEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreProjectEnvironment.java index e28de382d8df..d7fcde008e77 100644 --- a/platform/core-impl/src/com/intellij/core/CoreProjectEnvironment.java +++ b/platform/core-impl/src/com/intellij/core/CoreProjectEnvironment.java @@ -41,6 +41,8 @@ import com.intellij.psi.util.CachedValuesManager; import com.intellij.psi.util.PsiModificationTracker; import com.intellij.util.CachedValuesManagerImpl; import com.intellij.util.messages.impl.MessageBusImpl; +import org.jetbrains.annotations.NotNull; +import org.picocontainer.PicoContainer; public class CoreProjectEnvironment { private final Disposable myParentDisposable; @@ -54,7 +56,7 @@ public class CoreProjectEnvironment { public CoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) { myParentDisposable = parentDisposable; myEnvironment = applicationEnvironment; - myProject = new MockProject(myEnvironment.getApplication().getPicoContainer(), myParentDisposable); + myProject = createProject(myEnvironment.getApplication().getPicoContainer(), myParentDisposable); preregisterServices(); @@ -84,6 +86,10 @@ public class CoreProjectEnvironment { myProject.registerService(DumbService.class, new MockDumbService(myProject)); } + protected MockProject createProject(PicoContainer parent, @NotNull Disposable parentDisposable) { + return new MockProject(parent, parentDisposable); + } + protected ProjectScopeBuilder createProjectScopeBuilder() { return new CoreProjectScopeBuilder(myProject, myFileIndexFacade); } diff --git a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java index db813c8a3132..830b6f4d40c4 100644 --- a/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java +++ b/platform/core-impl/src/com/intellij/ide/plugins/PluginManagerCore.java @@ -29,10 +29,7 @@ import com.intellij.openapi.util.*; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.StreamUtil; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.util.ArrayUtil; -import com.intellij.util.Function; -import com.intellij.util.PlatformUtilsCore; -import com.intellij.util.ReflectionUtil; +import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.MultiMap; import com.intellij.util.execution.ParametersListUtil; @@ -72,7 +69,7 @@ public class PluginManagerCore { static final String EDIT = "edit"; @NonNls private static final String PROPERTY_PLUGIN_PATH = "plugin.path"; static List<String> ourDisabledPlugins = null; - static MultiMap<String, String> ourDisabledPluginVersions = null; + static MultiMap<String, String> ourBrokenPluginVersions = null; static IdeaPluginDescriptor[] ourPlugins; static String myPluginError = null; static List<String> myPlugins2Disable = null; @@ -120,9 +117,13 @@ public class PluginManagerCore { return ourDisabledPlugins; } - public static MultiMap<String, String> getDisabledPluginVersions() { - if (ourDisabledPluginVersions == null) { - ourDisabledPluginVersions = MultiMap.createSet(); + public static boolean isBrokenPlugin(IdeaPluginDescriptor descriptor) { + return getBrokenPluginVersions().get(descriptor.getPluginId().getIdString()).contains(descriptor.getVersion()); + } + + public static MultiMap<String, String> getBrokenPluginVersions() { + if (ourBrokenPluginVersions == null) { + ourBrokenPluginVersions = MultiMap.createSet(); if (System.getProperty("idea.ignore.disabled.plugins") == null && !isUnitTestMode()) { BufferedReader br = new BufferedReader(new InputStreamReader(PluginManagerCore.class.getResourceAsStream("/brokenPlugins.txt"))); @@ -142,7 +143,7 @@ public class PluginManagerCore { String pluginId = tokens.get(0); List<String> versions = tokens.subList(1, tokens.size()); - ourDisabledPluginVersions.putValues(pluginId, versions); + ourBrokenPluginVersions.putValues(pluginId, versions); } } catch (IOException e) { @@ -153,7 +154,7 @@ public class PluginManagerCore { } } } - return ourDisabledPluginVersions; + return ourBrokenPluginVersions; } static boolean isUnitTestMode() { @@ -954,7 +955,7 @@ public class PluginManagerCore { static boolean shouldSkipPlugin(final IdeaPluginDescriptor descriptor, IdeaPluginDescriptor[] loaded) { final String idString = descriptor.getPluginId().getIdString(); - if (idString.equals(CORE_PLUGIN_ID)) { + if (CORE_PLUGIN_ID.equals(idString)) { return false; } @@ -996,8 +997,7 @@ public class PluginManagerCore { } } } else { - shouldLoad = !getDisabledPlugins().contains(idString) && - !getDisabledPluginVersions().get(idString).contains(descriptor.getVersion()); + shouldLoad = !getDisabledPlugins().contains(idString); } if (shouldLoad && descriptor instanceof IdeaPluginDescriptorImpl) { if (isIncompatible(descriptor)) return true; @@ -1037,11 +1037,11 @@ public class PluginManagerCore { if (skipped != null) { return skipped.booleanValue(); } - boolean result = shouldSkipPlugin(descriptor, ourPlugins); + boolean result = shouldSkipPlugin(descriptor, ourPlugins) || isBrokenPlugin(descriptor); descriptorImpl.setSkipped(result); return result; } - return shouldSkipPlugin(descriptor, ourPlugins); + return shouldSkipPlugin(descriptor, ourPlugins) || isBrokenPlugin(descriptor); } static void initializePlugins(@Nullable StartupProgress progress) { @@ -1055,17 +1055,29 @@ public class PluginManagerCore { final List<IdeaPluginDescriptorImpl> result = new ArrayList<IdeaPluginDescriptorImpl>(); final HashMap<String, String> disabledPluginNames = new HashMap<String, String>(); + + List<String> brokenPluginsList = new ArrayList<String>(); + for (IdeaPluginDescriptorImpl descriptor : pluginDescriptors) { - final List<String> modules = descriptor.getModules(); - if (modules != null) { - for (String module : modules) { - if (!ourModulesToContainingPlugins.containsKey(module)) { - ourModulesToContainingPlugins.put(module, descriptor); - } + + boolean skipped = shouldSkipPlugin(descriptor, pluginDescriptors); + + if (!skipped) { + if (isBrokenPlugin(descriptor)) { + brokenPluginsList.add(descriptor.getName()); + skipped = true; } } - if (!shouldSkipPlugin(descriptor, pluginDescriptors)) { + if (!skipped) { + final List<String> modules = descriptor.getModules(); + if (modules != null) { + for (String module : modules) { + if (!ourModulesToContainingPlugins.containsKey(module)) { + ourModulesToContainingPlugins.put(module, descriptor); + } + } + } result.add(descriptor); } else { @@ -1075,7 +1087,14 @@ public class PluginManagerCore { } } - prepareLoadingPluginsErrorMessage(filterBadPlugins(result, disabledPluginNames)); + String errorMessage = filterBadPlugins(result, disabledPluginNames); + + if (!brokenPluginsList.isEmpty()) { + errorMessage = "Following plugins are incompatible with current IDE build: " + StringUtil.join(brokenPluginsList, ", ") + + "<br>\n" + StringUtil.notNullize(errorMessage); + } + + prepareLoadingPluginsErrorMessage(errorMessage); final Map<PluginId, IdeaPluginDescriptorImpl> idToDescriptorMap = new HashMap<PluginId, IdeaPluginDescriptorImpl>(); for (final IdeaPluginDescriptorImpl descriptor : result) { diff --git a/platform/core-impl/src/com/intellij/indentation/IndentationParser.java b/platform/core-impl/src/com/intellij/indentation/IndentationParser.java index 677876834d5b..dc46db89f5f6 100644 --- a/platform/core-impl/src/com/intellij/indentation/IndentationParser.java +++ b/platform/core-impl/src/com/intellij/indentation/IndentationParser.java @@ -54,6 +54,10 @@ public abstract class IndentationParser implements PsiParser { final PsiBuilder.Marker fileMarker = builder.mark(); final PsiBuilder.Marker documentMarker = builder.mark(); + while (builder.getTokenType() == myEolTokenType) { + advanceLexer(builder); + } + final Stack<BlockInfo> stack = new Stack<BlockInfo>(); stack.push(new BlockInfo(0, builder.mark(), builder.getTokenType())); diff --git a/platform/core-impl/src/com/intellij/mock/MockComponentManager.java b/platform/core-impl/src/com/intellij/mock/MockComponentManager.java index 6950a31c4961..c026211c232a 100644 --- a/platform/core-impl/src/com/intellij/mock/MockComponentManager.java +++ b/platform/core-impl/src/com/intellij/mock/MockComponentManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,20 +67,20 @@ public class MockComponentManager extends UserDataHolderBase implements Componen return null; } - public <T> void registerService(Class<T> serviceInterface, Class<? extends T> serviceImplementation) { + public <T> void registerService(@NotNull Class<T> serviceInterface, @NotNull Class<? extends T> serviceImplementation) { myPicoContainer.unregisterComponent(serviceInterface.getName()); myPicoContainer.registerComponentImplementation(serviceInterface.getName(), serviceImplementation); } - public <T> void registerService(Class<T> serviceImplementation) { + public <T> void registerService(@NotNull Class<T> serviceImplementation) { registerService(serviceImplementation, serviceImplementation); } - public <T> void registerService(Class<T> serviceInterface, T serviceImplementation) { + public <T> void registerService(@NotNull Class<T> serviceInterface, @NotNull T serviceImplementation) { myPicoContainer.registerComponentInstance(serviceInterface.getName(), serviceImplementation); } - public <T> void addComponent(Class<T> interfaceClass, T instance) { + public <T> void addComponent(@NotNull Class<T> interfaceClass, @NotNull T instance) { myComponents.put(interfaceClass, instance); } diff --git a/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java b/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java index c655b8d1e0db..cae738a775b3 100644 --- a/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.java +++ b/platform/core-impl/src/com/intellij/mock/MockFileDocumentManagerImpl.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. @@ -110,7 +110,7 @@ public class MockFileDocumentManagerImpl extends FileDocumentManager { } @Override - public void reloadFiles(final VirtualFile... files) { + public void reloadFiles(@NotNull final VirtualFile... files) { } @Override diff --git a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java index df9ed9cceca3..3d51b6ba470c 100644 --- a/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/editor/impl/DocumentImpl.java @@ -33,6 +33,7 @@ import com.intellij.openapi.util.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.reference.SoftReference; +import com.intellij.util.DocumentUtil; import com.intellij.util.IncorrectOperationException; import com.intellij.util.LocalTimeCounter; import com.intellij.util.Processor; @@ -46,9 +47,7 @@ import org.jetbrains.annotations.TestOnly; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; +import java.util.*; public class DocumentImpl extends UserDataHolderBase implements DocumentEx { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.DocumentImpl"); @@ -183,15 +182,10 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { final int finalStart = whiteSpaceStart; // document must be unblocked by now. If not, some Save handler attempted to modify PSI // which should have been caught by assertion in com.intellij.pom.core.impl.PomModelImpl.runTransaction - CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + DocumentUtil.writeInRunUndoTransparentAction(new DocumentRunnable(DocumentImpl.this, project) { @Override public void run() { - ApplicationManager.getApplication().runWriteAction(new DocumentRunnable(DocumentImpl.this, project) { - @Override - public void run() { - deleteString(finalStart, lineEnd); - } - }); + deleteString(finalStart, lineEnd); } }); text = myText; @@ -204,6 +198,92 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { return markAsNeedsStrippingLater; } + /** + * @return true if stripping was completed successfully, false if the document prevented stripping by e.g. caret(s) being in the way + */ + public boolean stripTrailingSpaces(@Nullable final Project project, + boolean inChangedLinesOnly, + boolean virtualSpaceEnabled, + @NotNull List<Integer> caretOffsets) { + if (!isStripTrailingSpacesEnabled) { + return true; + } + + boolean markAsNeedsStrippingLater = false; + CharSequence text = myText; + Map<Integer, List<RangeMarker>> caretMarkers = new HashMap<Integer, List<RangeMarker>>(caretOffsets.size()); + try { + if (!virtualSpaceEnabled) { + for (Integer caretOffset : caretOffsets) { + if (caretOffset == null || caretOffset < 0 || caretOffset > getTextLength()) { + continue; + } + Integer line = getLineNumber(caretOffset); + List<RangeMarker> markers = caretMarkers.get(line); + if (markers == null) { + markers = new ArrayList<RangeMarker>(); + caretMarkers.put(line, markers); + } + RangeMarker marker = createRangeMarker(caretOffset, caretOffset); + markers.add(marker); + } + } + lineLoop: + for (int line = 0; line < myLineSet.getLineCount(); line++) { + if (inChangedLinesOnly && !myLineSet.isModified(line)) continue; + int whiteSpaceStart = -1; + final int lineEnd = myLineSet.getLineEnd(line) - myLineSet.getSeparatorLength(line); + int lineStart = myLineSet.getLineStart(line); + for (int offset = lineEnd - 1; offset >= lineStart; offset--) { + char c = text.charAt(offset); + if (c != ' ' && c != '\t') { + break; + } + whiteSpaceStart = offset; + } + if (whiteSpaceStart == -1) continue; + if (!virtualSpaceEnabled) { + List<RangeMarker> markers = caretMarkers.get(line); + if (markers != null) { + for (RangeMarker marker : markers) { + if (marker.getStartOffset() >= 0 && whiteSpaceStart < marker.getStartOffset()) { + // mark this as a document that needs stripping later + // otherwise the caret would jump madly + markAsNeedsStrippingLater = true; + continue lineLoop; + } + } + } + } + final int finalStart = whiteSpaceStart; + // document must be unblocked by now. If not, some Save handler attempted to modify PSI + // which should have been caught by assertion in com.intellij.pom.core.impl.PomModelImpl.runTransaction + DocumentUtil.writeInRunUndoTransparentAction(new DocumentRunnable(DocumentImpl.this, project) { + @Override + public void run() { + deleteString(finalStart, lineEnd); + } + }); + text = myText; + } + } + finally { + for (List<RangeMarker> markerList : caretMarkers.values()) { + if (markerList != null) { + for (RangeMarker marker : markerList) { + try { + marker.dispose(); + } + catch (Exception e) { + LOG.error(e); + } + } + } + } + } + return markAsNeedsStrippingLater; + } + @Override public void setReadOnly(boolean isReadOnly) { if (myIsReadOnly != isReadOnly) { @@ -567,11 +647,16 @@ public class DocumentImpl extends UserDataHolderBase implements DocumentEx { myLineSet.clearModificationFlags(); } - public void clearLineModificationFlagsExcept(int caretLine) { - boolean wasModified = caretLine >= 0 && caretLine < myLineSet.getLineCount() && myLineSet.isModified(caretLine); + public void clearLineModificationFlagsExcept(@NotNull List<Integer> caretLines) { + List<Integer> modifiedLines = new ArrayList<Integer>(caretLines.size()); + for (Integer line : caretLines) { + if (line != null && line >= 0 && line < myLineSet.getLineCount() && myLineSet.isModified(line)) { + modifiedLines.add(line); + } + } clearLineModificationFlags(); - if (wasModified) { - myLineSet.setModified(caretLine); + for (Integer line : modifiedLines) { + myLineSet.setModified(line); } } diff --git a/platform/core-impl/src/com/intellij/openapi/vfs/impl/VirtualFileManagerImpl.java b/platform/core-impl/src/com/intellij/openapi/vfs/impl/VirtualFileManagerImpl.java index 59f56bd5b79d..3551a79e1206 100644 --- a/platform/core-impl/src/com/intellij/openapi/vfs/impl/VirtualFileManagerImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/vfs/impl/VirtualFileManagerImpl.java @@ -42,8 +42,9 @@ public class VirtualFileManagerImpl extends VirtualFileManagerEx { private final KeyedExtensionCollector<VirtualFileSystem, String> myCollector = new KeyedExtensionCollector<VirtualFileSystem, String>("com.intellij.virtualFileSystem") { + @NotNull @Override - protected String keyToString(String key) { + protected String keyToString(@NotNull String key) { return key; } }; @@ -247,57 +248,57 @@ public class VirtualFileManagerImpl extends VirtualFileManagerEx { private static class LoggingListener implements VirtualFileListener { @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { LOG.debug("propertyChanged: file = " + event.getFile() + ", propertyName = " + event.getPropertyName() + ", oldValue = " + event.getOldValue() + ", newValue = " + event.getNewValue() + ", requestor = " + event.getRequestor()); } @Override - public void contentsChanged(VirtualFileEvent event) { + public void contentsChanged(@NotNull VirtualFileEvent event) { LOG.debug("contentsChanged: file = " + event.getFile() + ", requestor = " + event.getRequestor()); } @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { LOG.debug("fileCreated: file = " + event.getFile() + ", requestor = " + event.getRequestor()); } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { LOG.debug("fileDeleted: file = " + event.getFile() + ", parent = " + event.getParent() + ", requestor = " + event.getRequestor()); } @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { LOG.debug("fileMoved: file = " + event.getFile() + ", oldParent = " + event.getOldParent() + ", newParent = " + event.getNewParent() + ", requestor = " + event.getRequestor()); } @Override - public void fileCopied(VirtualFileCopyEvent event) { + public void fileCopied(@NotNull VirtualFileCopyEvent event) { LOG.debug("fileCopied: file = " + event.getFile() + "originalFile = " + event.getOriginalFile() + ", requestor = " + event.getRequestor()); } @Override - public void beforeContentsChange(VirtualFileEvent event) { + public void beforeContentsChange(@NotNull VirtualFileEvent event) { LOG.debug("beforeContentsChange: file = " + event.getFile() + ", requestor = " + event.getRequestor()); } @Override - public void beforePropertyChange(VirtualFilePropertyEvent event) { + public void beforePropertyChange(@NotNull VirtualFilePropertyEvent event) { LOG.debug("beforePropertyChange: file = " + event.getFile() + ", propertyName = " + event.getPropertyName() + ", oldValue = " + event.getOldValue() + ", newValue = " + event.getNewValue() + ", requestor = " + event.getRequestor()); } @Override - public void beforeFileDeletion(VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull VirtualFileEvent event) { LOG.debug("beforeFileDeletion: file = " + event.getFile() + ", requestor = " + event.getRequestor()); LOG.assertTrue(event.getFile().isValid()); } @Override - public void beforeFileMovement(VirtualFileMoveEvent event) { + public void beforeFileMovement(@NotNull VirtualFileMoveEvent event) { LOG.debug("beforeFileMovement: file = " + event.getFile() + ", oldParent = " + event.getOldParent() + ", newParent = " + event.getNewParent() + ", requestor = " + event.getRequestor()); } diff --git a/platform/core-impl/src/com/intellij/psi/MultiplePsiFilesPerDocumentFileViewProvider.java b/platform/core-impl/src/com/intellij/psi/MultiplePsiFilesPerDocumentFileViewProvider.java index 0d0e16ce4967..c6554f83fb7a 100644 --- a/platform/core-impl/src/com/intellij/psi/MultiplePsiFilesPerDocumentFileViewProvider.java +++ b/platform/core-impl/src/com/intellij/psi/MultiplePsiFilesPerDocumentFileViewProvider.java @@ -42,8 +42,8 @@ public abstract class MultiplePsiFilesPerDocumentFileViewProvider extends Single private final ConcurrentMap<Language, PsiFile> myRoots = new ConcurrentHashMap<Language, PsiFile>(1, ConcurrentHashMap.DEFAULT_LOAD_FACTOR, 1); private MultiplePsiFilesPerDocumentFileViewProvider myOriginal = null; - public MultiplePsiFilesPerDocumentFileViewProvider(PsiManager manager, VirtualFile virtualFile, boolean physical) { - super(manager, virtualFile, physical, Language.ANY); + public MultiplePsiFilesPerDocumentFileViewProvider(PsiManager manager, VirtualFile virtualFile, boolean eventSystemEnabled) { + super(manager, virtualFile, eventSystemEnabled, Language.ANY); } @Override diff --git a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java index 742483a8d5ab..777eea35a1a5 100644 --- a/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java +++ b/platform/core-impl/src/com/intellij/psi/SingleRootFileViewProvider.java @@ -77,14 +77,14 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi this(manager, file, true); } - public SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean physical) { - this(manager, virtualFile, physical, calcBaseLanguage(virtualFile, manager.getProject())); + public SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean eventSystemEnabled) { + this(manager, virtualFile, eventSystemEnabled, calcBaseLanguage(virtualFile, manager.getProject())); } - protected SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean physical, @NotNull Language language) { + protected SingleRootFileViewProvider(@NotNull PsiManager manager, @NotNull VirtualFile virtualFile, final boolean eventSystemEnabled, @NotNull Language language) { myManager = manager; myVirtualFile = virtualFile; - myEventSystemEnabled = physical; + myEventSystemEnabled = eventSystemEnabled; myBaseLanguage = language; setContent(new VirtualFileContent()); myPhysical = isEventSystemEnabled() && diff --git a/platform/core-impl/src/com/intellij/psi/impl/EmptyFileManager.java b/platform/core-impl/src/com/intellij/psi/impl/EmptyFileManager.java index c415487237ed..8479be924ee7 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/EmptyFileManager.java +++ b/platform/core-impl/src/com/intellij/psi/impl/EmptyFileManager.java @@ -78,8 +78,8 @@ class EmptyFileManager implements FileManager { @Override @NotNull - public FileViewProvider createFileViewProvider(@NotNull final VirtualFile file, final boolean physical) { - return new SingleRootFileViewProvider(myManager, file, physical); + public FileViewProvider createFileViewProvider(@NotNull final VirtualFile file, final boolean eventSystemEnabled) { + return new SingleRootFileViewProvider(myManager, file, eventSystemEnabled); } @Override 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 7f7f9a910b54..d113c95d4d70 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiDocumentManagerBase.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 @@ import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.event.DocumentListener; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.fileTypes.BinaryFileTypeDecompilers; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; @@ -166,22 +167,23 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen Document document = getCachedDocument(file); if (document != null) { - if (!file.getViewProvider().isPhysical() && - document.getUserData(HARD_REF_TO_PSI) == null) { + if (!file.getViewProvider().isPhysical() && document.getUserData(HARD_REF_TO_PSI) == null) { cachePsi(document, file); } return document; } - if (!file.getViewProvider().isEventSystemEnabled()) return null; - document = FileDocumentManager.getInstance().getDocument(file.getViewProvider().getVirtualFile()); + FileViewProvider viewProvider = file.getViewProvider(); + if (!viewProvider.isEventSystemEnabled()) return null; + document = FileDocumentManager.getInstance().getDocument(viewProvider.getVirtualFile()); if (document != null) { if (document.getTextLength() != file.getTextLength()) { - throw new AssertionError("Modified PSI with no document: " + file + "; physical=" + file.getViewProvider().isPhysical()); + throw new AssertionError("Modified PSI with no document: " + file + "; physical=" + viewProvider.isPhysical() + + "; BFD=" + BinaryFileTypeDecompilers.INSTANCE.forFileType(file.getFileType())); } - if (!file.getViewProvider().isPhysical()) { + if (!viewProvider.isPhysical()) { cachePsi(document, file); } } @@ -690,17 +692,17 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen if (!myProject.isInitialized() || myProject.isDisposed()) { return; } - + VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(document); if (virtualFile == null || !FileIndexFacade.getInstance(myProject).isInContent(virtualFile)) { return; } - + final PsiFileImpl psiFile = (PsiFileImpl)getPsiFile(document); if (psiFile == null) { return; } - + ApplicationManager.getApplication().runWriteAction(new Runnable() { public void run() { psiFile.getViewProvider().beforeContentsSynchronized(); diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiFileFactoryImpl.java b/platform/core-impl/src/com/intellij/psi/impl/PsiFileFactoryImpl.java index 39e302c73ac5..a24a942bcfea 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiFileFactoryImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiFileFactoryImpl.java @@ -51,8 +51,8 @@ public class PsiFileFactoryImpl extends PsiFileFactory { @Override @NotNull public PsiFile createFileFromText(@NotNull String name, @NotNull FileType fileType, @NotNull CharSequence text, - long modificationStamp, final boolean physical) { - return createFileFromText(name, fileType, text, modificationStamp, physical, true); + long modificationStamp, final boolean eventSystemEnabled) { + return createFileFromText(name, fileType, text, modificationStamp, eventSystemEnabled, true); } @Override @@ -61,22 +61,22 @@ public class PsiFileFactoryImpl extends PsiFileFactory { } @Override - public PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text, boolean physical, boolean markAsCopy) { - return createFileFromText(name, language, text, physical, markAsCopy, false); + public PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text, boolean eventSystemEnabled, boolean markAsCopy) { + return createFileFromText(name, language, text, eventSystemEnabled, markAsCopy, false); } @Override public PsiFile createFileFromText(@NotNull String name, @NotNull Language language, @NotNull CharSequence text, - boolean physical, + boolean eventSystemEnabled, boolean markAsCopy, boolean noSizeLimit) { LightVirtualFile virtualFile = new LightVirtualFile(name, language, text); if (noSizeLimit) { SingleRootFileViewProvider.doNotCheckFileSizeLimit(virtualFile); } - return trySetupPsiForFile(virtualFile, language, physical, markAsCopy); + return trySetupPsiForFile(virtualFile, language, eventSystemEnabled, markAsCopy); } @Override @@ -85,17 +85,17 @@ public class PsiFileFactoryImpl extends PsiFileFactory { @NotNull FileType fileType, @NotNull CharSequence text, long modificationStamp, - final boolean physical, + final boolean eventSystemEnabled, boolean markAsCopy) { final LightVirtualFile virtualFile = new LightVirtualFile(name, fileType, text, modificationStamp); if(fileType instanceof LanguageFileType){ final Language language = LanguageSubstitutors.INSTANCE.substituteLanguage(((LanguageFileType)fileType).getLanguage(), virtualFile, myManager.getProject()); - final PsiFile file = trySetupPsiForFile(virtualFile, language, physical, markAsCopy); + final PsiFile file = trySetupPsiForFile(virtualFile, language, eventSystemEnabled, markAsCopy); if (file != null) return file; } final SingleRootFileViewProvider singleRootFileViewProvider = - new SingleRootFileViewProvider(myManager, virtualFile, physical); + new SingleRootFileViewProvider(myManager, virtualFile, eventSystemEnabled); final PsiPlainTextFileImpl plainTextFile = new PsiPlainTextFileImpl(singleRootFileViewProvider); if(markAsCopy) CodeEditUtil.setNodeGenerated(plainTextFile.getNode(), true); return plainTextFile; diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java index 09a046c04729..a25c3d52eddf 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -143,7 +143,7 @@ public class PsiManagerImpl extends PsiManagerEx { } @TestOnly - public void setAssertOnFileLoadingFilter(@NotNull VirtualFileFilter filter, Disposable parentDisposable) { + public void setAssertOnFileLoadingFilter(@NotNull VirtualFileFilter filter, @NotNull Disposable parentDisposable) { // Find something to ensure there's no changed files waiting to be processed in repository indices. myAssertOnFileLoadingFilter = filter; Disposer.register(parentDisposable, new Disposable() { @@ -237,7 +237,7 @@ public class PsiManagerImpl extends PsiManagerEx { } @Override - public void addPsiTreeChangeListener(@NotNull final PsiTreeChangeListener listener, Disposable parentDisposable) { + public void addPsiTreeChangeListener(@NotNull final PsiTreeChangeListener listener, @NotNull Disposable parentDisposable) { addPsiTreeChangeListener(listener); Disposer.register(parentDisposable, new Disposable() { @Override @@ -290,7 +290,7 @@ public class PsiManagerImpl extends PsiManagerEx { fireEvent(event); } - public void beforeChildrenChange(PsiTreeChangeEventImpl event) { + public void beforeChildrenChange(@NotNull PsiTreeChangeEventImpl event) { beforeChange(true); event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILDREN_CHANGE); if (LOG.isDebugEnabled()) { @@ -299,7 +299,7 @@ public class PsiManagerImpl extends PsiManagerEx { fireEvent(event); } - public void beforeChildMovement(PsiTreeChangeEventImpl event) { + public void beforeChildMovement(@NotNull PsiTreeChangeEventImpl event) { beforeChange(true); event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_CHILD_MOVEMENT); if (LOG.isDebugEnabled()) { @@ -312,7 +312,7 @@ public class PsiManagerImpl extends PsiManagerEx { fireEvent(event); } - public void beforePropertyChange(PsiTreeChangeEventImpl event) { + public void beforePropertyChange(@NotNull PsiTreeChangeEventImpl event) { beforeChange(true); event.setCode(PsiTreeChangeEventImpl.PsiEventType.BEFORE_PROPERTY_CHANGE); if (LOG.isDebugEnabled()) { @@ -325,7 +325,7 @@ public class PsiManagerImpl extends PsiManagerEx { fireEvent(event); } - public void childAdded(PsiTreeChangeEventImpl event) { + public void childAdded(@NotNull PsiTreeChangeEventImpl event) { event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_ADDED); if (LOG.isDebugEnabled()) { LOG.debug( @@ -337,7 +337,7 @@ public class PsiManagerImpl extends PsiManagerEx { afterChange(true); } - public void childRemoved(PsiTreeChangeEventImpl event) { + public void childRemoved(@NotNull PsiTreeChangeEventImpl event) { event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_REMOVED); if (LOG.isDebugEnabled()) { LOG.debug( @@ -348,7 +348,7 @@ public class PsiManagerImpl extends PsiManagerEx { afterChange(true); } - public void childReplaced(PsiTreeChangeEventImpl event) { + public void childReplaced(@NotNull PsiTreeChangeEventImpl event) { event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_REPLACED); if (LOG.isDebugEnabled()) { LOG.debug( @@ -361,7 +361,7 @@ public class PsiManagerImpl extends PsiManagerEx { afterChange(true); } - public void childMoved(PsiTreeChangeEventImpl event) { + public void childMoved(@NotNull PsiTreeChangeEventImpl event) { event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILD_MOVED); if (LOG.isDebugEnabled()) { LOG.debug( @@ -374,7 +374,7 @@ public class PsiManagerImpl extends PsiManagerEx { afterChange(true); } - public void childrenChanged(PsiTreeChangeEventImpl event) { + public void childrenChanged(@NotNull PsiTreeChangeEventImpl event) { event.setCode(PsiTreeChangeEventImpl.PsiEventType.CHILDREN_CHANGED); if (LOG.isDebugEnabled()) { LOG.debug( @@ -385,7 +385,7 @@ public class PsiManagerImpl extends PsiManagerEx { afterChange(true); } - public void propertyChanged(PsiTreeChangeEventImpl event) { + public void propertyChanged(@NotNull PsiTreeChangeEventImpl event) { event.setCode(PsiTreeChangeEventImpl.PsiEventType.PROPERTY_CHANGED); if (LOG.isDebugEnabled()) { LOG.debug( @@ -399,11 +399,11 @@ public class PsiManagerImpl extends PsiManagerEx { afterChange(true); } - public void addTreeChangePreprocessor(PsiTreeChangePreprocessor preprocessor) { + public void addTreeChangePreprocessor(@NotNull PsiTreeChangePreprocessor preprocessor) { myTreeChangePreprocessors.add(preprocessor); } - private void fireEvent(PsiTreeChangeEventImpl event) { + private void fireEvent(@NotNull PsiTreeChangeEventImpl event) { boolean isRealTreeChange = event.getCode() != PsiTreeChangeEventImpl.PsiEventType.PROPERTY_CHANGED && event.getCode() != PsiTreeChangeEventImpl.PsiEventType.BEFORE_PROPERTY_CHANGE; diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.java b/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.java index bd72e043ab8a..479ff3d6670c 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/file/PsiDirectoryImpl.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. @@ -323,7 +323,7 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory, Qu @Override public boolean isPhysical() { - return !(myFile.getFileSystem() instanceof NonPhysicalFileSystem) && !(myFile.getFileSystem().getProtocol().equals("temp")); + return !(myFile.getFileSystem() instanceof NonPhysicalFileSystem) && !myFile.getFileSystem().getProtocol().equals("temp"); } /** @@ -415,7 +415,7 @@ public class PsiDirectoryImpl extends PsiElementBase implements PsiDirectory, Qu } } - private static void updateAddedFile(PsiFile copyPsi) throws IncorrectOperationException { + private static void updateAddedFile(@NotNull PsiFile copyPsi) throws IncorrectOperationException { final UpdateAddedFileProcessor processor = UpdateAddedFileProcessor.forElement(copyPsi); if (processor != null) { final TreeElement tree = (TreeElement)SourceTreeToPsiMap.psiElementToTree(copyPsi); diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/PsiFileImplUtil.java b/platform/core-impl/src/com/intellij/psi/impl/file/PsiFileImplUtil.java index ab43c5abd1e3..42f0857eb21a 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/file/PsiFileImplUtil.java +++ b/platform/core-impl/src/com/intellij/psi/impl/file/PsiFileImplUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.psi.impl.PsiManagerImpl; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -32,7 +33,7 @@ public class PsiFileImplUtil { private PsiFileImplUtil() { } - public static PsiFile setName(final PsiFile file, String newName) throws IncorrectOperationException { + public static PsiFile setName(@NotNull PsiFile file, @NotNull String newName) throws IncorrectOperationException { VirtualFile vFile = file.getViewProvider().getVirtualFile(); PsiManagerImpl manager = (PsiManagerImpl)file.getManager(); @@ -56,7 +57,7 @@ public class PsiFileImplUtil { return file.getViewProvider().isPhysical() ? manager.findFile(vFile) : file; } - public static void checkSetName(PsiFile file, String name) throws IncorrectOperationException { + public static void checkSetName(@NotNull PsiFile file, @NotNull String name) throws IncorrectOperationException { VirtualFile vFile = file.getVirtualFile(); VirtualFile parentFile = vFile.getParent(); if (parentFile == null) return; @@ -66,7 +67,7 @@ public class PsiFileImplUtil { } } - public static void doDelete(final PsiFile file) throws IncorrectOperationException { + public static void doDelete(@NotNull PsiFile file) throws IncorrectOperationException { final PsiManagerImpl manager = (PsiManagerImpl)file.getManager(); final VirtualFile vFile = file.getVirtualFile(); diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/UpdateAddedFileProcessor.java b/platform/core-impl/src/com/intellij/psi/impl/file/UpdateAddedFileProcessor.java index ded9f34fc3f0..757f3f330783 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/file/UpdateAddedFileProcessor.java +++ b/platform/core-impl/src/com/intellij/psi/impl/file/UpdateAddedFileProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.extensions.ExtensionPointName; import com.intellij.openapi.extensions.Extensions; import com.intellij.psi.PsiFile; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -30,12 +31,12 @@ import org.jetbrains.annotations.Nullable; public abstract class UpdateAddedFileProcessor { private static final ExtensionPointName<UpdateAddedFileProcessor> EP_NAME = ExtensionPointName.create("com.intellij.updateAddedFileProcessor"); - public abstract boolean canProcessElement(PsiFile element); + public abstract boolean canProcessElement(@NotNull PsiFile element); public abstract void update(PsiFile element, @Nullable PsiFile originalElement) throws IncorrectOperationException; @Nullable - public static UpdateAddedFileProcessor forElement(PsiFile element) { + public static UpdateAddedFileProcessor forElement(@NotNull PsiFile element) { for(UpdateAddedFileProcessor processor: Extensions.getExtensions(EP_NAME)) { if (processor.canProcessElement(element)) { return processor; diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManager.java b/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManager.java index 4a94b3adb40b..b95946c1d5e2 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManager.java +++ b/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManager.java @@ -50,5 +50,5 @@ public interface FileManager extends Disposable { List<PsiFile> getAllCachedFiles(); @NotNull - FileViewProvider createFileViewProvider(@NotNull VirtualFile file, boolean physical); + FileViewProvider createFileViewProvider(@NotNull VirtualFile file, boolean eventSystemEnabled); } diff --git a/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java index 2e94b48e4b7a..e1a390b8d9f3 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/file/impl/FileManagerImpl.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. @@ -106,6 +106,7 @@ public class FileManagerImpl implements FileManager { } @TestOnly + @NotNull public ConcurrentMap<VirtualFile, FileViewProvider> getVFileToViewProviderMap() { return myVFileToViewProviderMap; } @@ -169,7 +170,7 @@ public class FileManagerImpl implements FileManager { } @Nullable - private FileViewProvider getFromInjected(VirtualFile file) { + private FileViewProvider getFromInjected(@NotNull VirtualFile file) { if (file instanceof VirtualFileWindow) { DocumentWindow document = ((VirtualFileWindow)file).getDocumentWindow(); PsiFile psiFile = PsiDocumentManager.getInstance(myManager.getProject()).getCachedPsiFile(document); @@ -193,18 +194,18 @@ public class FileManagerImpl implements FileManager { @Override @NotNull - public FileViewProvider createFileViewProvider(@NotNull final VirtualFile file, boolean physical) { + public FileViewProvider createFileViewProvider(@NotNull final VirtualFile file, boolean eventSystemEnabled) { Language language = getLanguage(file); final FileViewProviderFactory factory = language == null ? FileTypeFileViewProviders.INSTANCE.forFileType(file.getFileType()) : LanguageFileViewProviders.INSTANCE.forLanguage(language); - FileViewProvider viewProvider = factory == null ? null : factory.createFileViewProvider(file, language, myManager, physical); + FileViewProvider viewProvider = factory == null ? null : factory.createFileViewProvider(file, language, myManager, eventSystemEnabled); - return viewProvider == null ? new SingleRootFileViewProvider(myManager, file, physical) : viewProvider; + return viewProvider == null ? new SingleRootFileViewProvider(myManager, file, eventSystemEnabled) : viewProvider; } @Nullable - private Language getLanguage(final VirtualFile file) { + private Language getLanguage(@NotNull VirtualFile file) { final FileType fileType = file.getFileType(); Project project = myManager.getProject(); if (fileType instanceof LanguageFileType) { @@ -252,14 +253,12 @@ public class FileManagerImpl implements FileManager { updateMaps(); - event = new PsiTreeChangeEventImpl(myManager); - event.setPropertyName(PsiTreeChangeEvent.PROP_FILE_TYPES); myManager.propertyChanged(event); } } private boolean myProcessingFileTypesChange = false; - private void handleFileTypesChange(final FileTypesChanged runnable) { + private void handleFileTypesChange(@NotNull FileTypesChanged runnable) { if (myProcessingFileTypesChange) return; myProcessingFileTypesChange = true; try { @@ -366,7 +365,7 @@ public class FileManagerImpl implements FileManager { } @Nullable - private PsiDirectory findDirectoryImpl(final VirtualFile vFile) { + private PsiDirectory findDirectoryImpl(@NotNull VirtualFile vFile) { PsiDirectory psiDir = myVFileToPsiDirMap.get(vFile); if (psiDir != null) return psiDir; @@ -381,11 +380,11 @@ public class FileManagerImpl implements FileManager { return ConcurrencyUtil.cacheOrGet(myVFileToPsiDirMap, vFile, psiDir); } - PsiDirectory getCachedDirectory(VirtualFile vFile) { + PsiDirectory getCachedDirectory(@NotNull VirtualFile vFile) { return myVFileToPsiDirMap.get(vFile); } - void cacheViewProvider(@NotNull VirtualFile vFile, FileViewProvider viewProvider) { + void cacheViewProvider(@NotNull VirtualFile vFile, @Nullable FileViewProvider viewProvider) { if (viewProvider == null) { removeCachedViewProvider(vFile); } @@ -398,7 +397,7 @@ public class FileManagerImpl implements FileManager { myVFileToViewProviderMap.remove(vFile); } - void removeFilesAndDirsRecursively(VirtualFile vFile) { + void removeFilesAndDirsRecursively(@NotNull VirtualFile vFile) { VfsUtilCore.visitChildrenRecursively(vFile, new VirtualFileVisitor() { @Override public boolean visitFile(@NotNull VirtualFile file) { @@ -414,7 +413,7 @@ public class FileManagerImpl implements FileManager { } @Nullable - PsiFile getCachedPsiFileInner(VirtualFile file) { + PsiFile getCachedPsiFileInner(@NotNull VirtualFile file) { final FileViewProvider fileViewProvider = myVFileToViewProviderMap.get(file); return fileViewProvider instanceof SingleRootFileViewProvider ? ((SingleRootFileViewProvider)fileViewProvider).getCachedPsi(fileViewProvider.getBaseLanguage()) : null; @@ -497,7 +496,7 @@ public class FileManagerImpl implements FileManager { reloadFromDisk(file, false); } - void reloadFromDisk(PsiFile file, boolean ignoreDocument) { + void reloadFromDisk(@NotNull PsiFile file, boolean ignoreDocument) { VirtualFile vFile = file.getVirtualFile(); assert vFile != null; diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java index b5070410025f..13a85846a045 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/text/BlockSupportImpl.java @@ -19,6 +19,7 @@ package com.intellij.psi.impl.source.text; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.ex.DocumentBulkUpdateListener; @@ -137,22 +138,24 @@ public class BlockSupportImpl extends BlockSupport { } private static boolean assertFileLength(PsiFile file, CharSequence newFileText, ASTNode node, IElementType elementType, int start, int end) { - if ((end > newFileText.length() || start > end) && ApplicationManager.getApplication().isInternal()) { - String newTextBefore = newFileText.subSequence(0, start).toString(); - String oldTextBefore = file.getText().subSequence(0, start).toString(); + if (end > newFileText.length() || start > end) { String message = "IOOBE: type=" + elementType + + "; file=" + file + + "; file.class=" + file.getClass() + "; start=" + start + "; end=" + end + - "; oldText=" + node.getText() + - "; newText=" + newFileText.subSequence(start, newFileText.length()) + "; length=" + node.getTextLength(); + String newTextBefore = newFileText.subSequence(0, start).toString(); + String oldTextBefore = file.getText().subSequence(0, start).toString(); if (oldTextBefore.equals(newTextBefore)) { message += "; oldTextBefore==newTextBefore"; - } else { - message += "; oldTextBefore=" + oldTextBefore + - "; newTextBefore=" + newTextBefore; } - LOG.error(message); + LOG.error(message, + new Attachment(file.getName() + "_oldText.txt", node.getText()), + new Attachment(file.getName() + "_newText.txt", node.getText()), + new Attachment(file.getName() + "_oldTextBefore.txt", oldTextBefore), + new Attachment(file.getName() + "_newTextBefore.txt", newTextBefore) + ); return false; } return true; diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java index e33bcb41bf24..0df2c3f08a13 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/tree/LeafElement.java @@ -19,9 +19,11 @@ package com.intellij.psi.impl.source.tree; import com.intellij.lang.ASTFactory; import com.intellij.lang.ASTNode; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.util.Key; import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.TokenSet; +import com.intellij.reference.SoftReference; import com.intellij.util.IncorrectOperationException; import com.intellij.util.text.CharArrayUtil; import org.jetbrains.annotations.NotNull; @@ -29,6 +31,7 @@ import org.jetbrains.annotations.Nullable; public abstract class LeafElement extends TreeElement { private static final Logger LOG = Logger.getInstance("com.intellij.psi.impl.source.tree.LeafElement"); + private static final Key<SoftReference<String>> CACHED_TEXT = Key.create("CACHED_TEXT"); private static final int TEXT_MATCHES_THRESHOLD = 5; @@ -58,6 +61,15 @@ public abstract class LeafElement extends TreeElement { @Override public String getText() { + if (myText.length() > 1000 && !(myText instanceof String)) { // e.g. a large text file + String text = SoftReference.dereference(getUserData(CACHED_TEXT)); + if (text == null) { + text = myText.toString(); + putUserData(CACHED_TEXT, new SoftReference<String>(text)); + } + return text; + } + return myText.toString(); } diff --git a/platform/core-impl/src/com/intellij/util/DocumentUtil.java b/platform/core-impl/src/com/intellij/util/DocumentUtil.java index 6eb84897d985..a4a83a15be9d 100644 --- a/platform/core-impl/src/com/intellij/util/DocumentUtil.java +++ b/platform/core-impl/src/com/intellij/util/DocumentUtil.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,18 +15,16 @@ */ package com.intellij.util; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.ex.DocumentEx; import org.jetbrains.annotations.NotNull; /** * Is intended to hold utility methods to use during {@link Document} processing. - * - * @author Denis Zhdanov - * @since 5/16/12 10:12 AM */ -public class DocumentUtil { - +public final class DocumentUtil { private DocumentUtil() { } @@ -58,4 +56,13 @@ public class DocumentUtil { documentEx.setInBulkUpdate(!executeInBulk); } } + + public static void writeInRunUndoTransparentAction(@NotNull final Runnable runnable) { + CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + @Override + public void run() { + ApplicationManager.getApplication().runWriteAction(runnable); + } + }); + } } diff --git a/platform/editor-ui-api/editor-ui-api.iml b/platform/editor-ui-api/editor-ui-api.iml index 3de8227812bb..d45353c10fc4 100644 --- a/platform/editor-ui-api/editor-ui-api.iml +++ b/platform/editor-ui-api/editor-ui-api.iml @@ -12,6 +12,8 @@ <orderEntry type="module" module-name="annotations" /> <orderEntry type="module" module-name="projectModel-api" /> <orderEntry type="module" module-name="indexing-api" /> + <orderEntry type="module" module-name="structure-view-api" /> + <orderEntry type="module" module-name="analysis-api" /> </component> </module> diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java index c58ab30b93bd..f0667e67d8db 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/Presentation.java @@ -118,7 +118,7 @@ public final class Presentation implements Cloneable { return myText; } - public void setText(String text, boolean mayContainMnemonic) { + public void setText(@Nullable String text, boolean mayContainMnemonic) { int oldMnemonic = myMnemonic; int oldDisplayedMnemonicIndex = myDisplayedMnemonicIndex; String oldText = myText; diff --git a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ex/AnActionListener.java b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ex/AnActionListener.java index f494fdc710ad..e195cd193218 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ex/AnActionListener.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ex/AnActionListener.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,6 +35,9 @@ import com.intellij.openapi.actionSystem.DataContext; public interface AnActionListener { void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event); + /** + * Note that using <code>dataContext</code> in implementing methods is unsafe - it could have been invalidated by the performed action. + */ void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event); void beforeEditorTyping(char c, DataContext dataContext); diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/CaretModel.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/CaretModel.java index 776566f900ec..17ddb3f820b3 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/CaretModel.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/CaretModel.java @@ -21,7 +21,6 @@ import com.intellij.openapi.util.Segment; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.Collection; import java.util.List; /** @@ -168,8 +167,8 @@ public interface CaretModel { /** * Returns current caret - the one, query and update methods in the model operate at the moment. In the current implementation this is - * either an iteration-current caret within the context of {@link #runForEachCaret(Runnable)} method, or the 'primary' caret without that - * context. Users {@link #runForEachCaret(Runnable)} method should use caret parameter passed to + * either an iteration-current caret within the context of {@link #runForEachCaret(CaretAction)} method, or the 'primary' caret without that + * context. Users {@link #runForEachCaret(CaretAction)} method should use caret parameter passed to * {@link com.intellij.openapi.editor.CaretAction#perform(Caret)} method instead of this method, as the definition of current caret (as * well as caret instance operated on by model methods) can potentially change. */ @@ -186,7 +185,7 @@ public interface CaretModel { * Returns all carets currently existing in the document, ordered by their position in the document. */ @NotNull - Collection<Caret> getAllCarets(); + List<Caret> getAllCarets(); /** * Returns a caret at the given position in the document, or <code>null</code>, if there's no caret there. @@ -215,14 +214,14 @@ public interface CaretModel { void removeSecondaryCarets(); /** - * Sets the number of carets, their positions and selection ranges according to the provided parameters. Null values in any of the lists - * will mean that corresponding caret's position and/or selection won't be changed. + * Sets the number of carets, their positions and selection ranges according to the provided parameters. Null values in any of the + * collections will mean that corresponding caret's position and/or selection won't be changed. * <p> * If multiple carets are not supported, the behaviour is unspecified. * * @see #supportsMultipleCarets() */ - void setCarets(@NotNull List<LogicalPosition> caretPositions, @NotNull List<? extends Segment> selections); + void setCaretsAndSelections(@NotNull List<LogicalPosition> caretPositions, @NotNull List<? extends Segment> selections); /** * Executes the given task for each existing caret. Carets are iterated in their position order. Set of carets to iterate over is diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorLastActionTracker.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorLastActionTracker.java new file mode 100644 index 000000000000..9e580b60feb6 --- /dev/null +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/EditorLastActionTracker.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.openapi.editor; + +import com.intellij.openapi.application.ApplicationManager; +import org.jetbrains.annotations.Nullable; + +/** + * This component provides the notion of last editor action. + * Its purpose is to be able to determine whether some action was performed right after another specific action. + * <p> + * It's supposed to be used from EDT only. + */ +public abstract class EditorLastActionTracker { + public static EditorLastActionTracker getInstance() { + return ApplicationManager.getApplication().getComponent(EditorLastActionTracker.class); + } + + /** + * Returns the id of the previously invoked action or <code>null</code>, if no history exists yet, or last user activity was of + * non-action type, like mouse clicking in editor or text typing, or previous action was invoked for a different editor. + */ + @Nullable + public abstract String getLastActionId(); +} diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/IndentStrategy.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/IndentStrategy.java index 7ebb2bf409de..fccb8f02aab7 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/IndentStrategy.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/IndentStrategy.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,6 +16,7 @@ package com.intellij.openapi.editor; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; /** * Defines whether or not some elements can be indented when a user selects a fragment of text and invokes "indent" action (normally by @@ -31,5 +32,5 @@ public interface IndentStrategy { * @param element The element to check. * @return True if the element can change its indentation, false if the indentation must be preserved. */ - boolean canIndent(PsiElement element); + boolean canIndent(@NotNull PsiElement element); } diff --git a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java index 099c27077f1f..a0a8372eff42 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/editor/markup/RangeHighlighter.java @@ -45,6 +45,7 @@ public interface RangeHighlighter extends RangeMarker { * * @return the highlighter target area. */ + @NotNull HighlighterTargetArea getTargetArea(); /** diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditor.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditor.java index f22010baa31a..c251020aaf4f 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditor.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java index 696c6b991127..e62f21841f78 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/openapi/fileEditor/FileEditorState.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java index 277a679e2b92..f8557358ac00 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorState.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.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. diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java index 4408f12db539..0cd2a91e0c49 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java index c742e08b0824..3d9b84b6f44c 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/openapi/fileEditor/TextEditor.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/TextEditor.java index 8c0578b8cf38..99d9b1444ff7 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileEditor/TextEditor.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/TextEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/editor-ui-api/src/com/intellij/openapi/fileTypes/FileTypeEditorHighlighterProviders.java b/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/FileTypeEditorHighlighterProviders.java index 389fd54358fa..5f8e766931b9 100644 --- a/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/FileTypeEditorHighlighterProviders.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/fileTypes/FileTypeEditorHighlighterProviders.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. @@ -36,8 +36,9 @@ public class FileTypeEditorHighlighterProviders extends FileTypeExtension<Editor super("com.intellij.editorHighlighterProvider"); } + @NotNull @Override - protected List<EditorHighlighterProvider> buildExtensions(String stringKey, final FileType key) { + protected List<EditorHighlighterProvider> buildExtensions(@NotNull String stringKey, @NotNull final FileType key) { List<EditorHighlighterProvider> fromEP = super.buildExtensions(stringKey, key); if (fromEP.isEmpty()) { EditorHighlighterProvider defaultProvider = new EditorHighlighterProvider() { diff --git a/platform/platform-api/src/com/intellij/openapi/ide/CopyPasteManager.java b/platform/editor-ui-api/src/com/intellij/openapi/ide/CopyPasteManager.java index c96ce0ae3f81..756631c6b3ff 100644 --- a/platform/platform-api/src/com/intellij/openapi/ide/CopyPasteManager.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/ide/CopyPasteManager.java @@ -33,11 +33,11 @@ public abstract class CopyPasteManager { return ServiceManager.getService(CopyPasteManager.class); } - public abstract void addContentChangedListener(ContentChangedListener listener); + public abstract void addContentChangedListener(@NotNull ContentChangedListener listener); - public abstract void addContentChangedListener(ContentChangedListener listener, Disposable parentDisposable); + public abstract void addContentChangedListener(@NotNull ContentChangedListener listener, @NotNull Disposable parentDisposable); - public abstract void removeContentChangedListener(ContentChangedListener listener); + public abstract void removeContentChangedListener(@NotNull ContentChangedListener listener); /** @deprecated use {@link #getContents(DataFlavor)} or {@link #areDataFlavorsAvailable(DataFlavor...)} (to remove in IDEA 14) */ @SuppressWarnings("unused") @@ -53,6 +53,7 @@ public abstract class CopyPasteManager { @Nullable public abstract <T> T getContents(@NotNull DataFlavor flavor); + @NotNull public abstract Transferable[] getAllContents(); public abstract void setContents(@NotNull Transferable content); diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatus.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatus.java index 0dc2ca3b08c6..4b57f9cf327d 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatus.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatus.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.openapi.vcs; import com.intellij.openapi.editor.colors.ColorKey; import com.intellij.ui.Gray; +import org.jetbrains.annotations.NotNull; import java.awt.*; @@ -24,7 +25,6 @@ public interface FileStatus { Color COLOR_NOT_CHANGED = null; // deliberately null, do not use hardcoded Color.BLACK Color COLOR_NOT_CHANGED_RECURSIVE = new Color(138, 164, 200); Color COLOR_NOT_CHANGED_IMMEDIATE = new Color(50, 100, 180); - Color t = new Color(47, 109, 255); Color COLOR_MERGE = new Color(117, 3, 220); Color COLOR_MODIFIED = new Color(0, 50, 160); @@ -63,7 +63,9 @@ public interface FileStatus { Color getColor(); + @NotNull ColorKey getColorKey(); + @NotNull String getId(); } diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusFactory.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusFactory.java index 1227c9e7b6b1..cb5d4808b55d 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusFactory.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,8 +16,9 @@ package com.intellij.openapi.vcs; import com.intellij.openapi.editor.colors.ColorKey; -import com.intellij.openapi.vcs.impl.FileStatusImpl; +import com.intellij.openapi.editor.colors.EditorColorsManager; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.awt.*; import java.util.ArrayList; @@ -30,13 +31,13 @@ public class FileStatusFactory { private FileStatusFactory() { } - public synchronized FileStatus createFileStatus(@NonNls String id, String description, Color color) { + public synchronized FileStatus createFileStatus(@NonNls @NotNull String id, @NotNull String description, Color color) { FileStatusImpl result = new FileStatusImpl(id, ColorKey.createColorKey("FILESTATUS_" + id, color), description); myStatuses.add(result); return result; } - public synchronized FileStatus createOnlyColorForFileStatus(@NonNls String id, final Color color) { + public synchronized FileStatus createOnlyColorForFileStatus(@NonNls @NotNull String id, final Color color) { FileStatus result = new FileStatusImpl.OnlyColorFileStatus(id, ColorKey.createColorKey("FILESTATUS_" + id, color), null); myStatuses.add(result); return result; @@ -50,4 +51,61 @@ public class FileStatusFactory { return ourInstance; } -}
\ No newline at end of file + /** + * author: lesya + */ + private static class FileStatusImpl implements FileStatus { + private final String myStatus; + private final ColorKey myColorKey; + private final String myText; + + public FileStatusImpl(@NotNull String status, @NotNull ColorKey key, String text) { + myStatus = status; + myColorKey = key; + myText = text; + } + + public String toString() { + return myStatus; + } + + @Override + public String getText() { + return myText; + } + + @Override + public Color getColor() { + return EditorColorsManager.getInstance().getGlobalScheme().getColor(getColorKey()); + } + + @NotNull + @Override + public ColorKey getColorKey() { + return myColorKey; + } + + @NotNull + @Override + public String getId() { + return myStatus; + } + + private static class OnlyColorFileStatus extends FileStatusImpl { + public OnlyColorFileStatus(@NotNull String status, @NotNull ColorKey key, String text) { + super(status, key, text); + } + + @NotNull + @Override + public String getId() { + throw new UnsupportedOperationException(); + } + + @Override + public String getText() { + throw new UnsupportedOperationException(); + } + } + } +} diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusListener.java index a556fb4e104e..f53a2adc086a 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ import org.jetbrains.annotations.NotNull; public interface FileStatusListener { /** * Indicates that some file statuses were change. On this event client should recalculate all statuses - * it's depenedend on. + * it's dependent on. */ void fileStatusesChanged(); void fileStatusChanged(@NotNull VirtualFile virtualFile); diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusManager.java index f2fad70bb48e..4c40f9120a46 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusManager.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,23 +35,23 @@ public abstract class FileStatusManager { public abstract void fileStatusesChanged(); public abstract void fileStatusChanged(VirtualFile file); - public abstract void addFileStatusListener(FileStatusListener listener); - public abstract void addFileStatusListener(FileStatusListener listener, Disposable parentDisposable); - public abstract void removeFileStatusListener(FileStatusListener listener); + public abstract void addFileStatusListener(@NotNull FileStatusListener listener); + public abstract void addFileStatusListener(@NotNull FileStatusListener listener, @NotNull Disposable parentDisposable); + public abstract void removeFileStatusListener(@NotNull FileStatusListener listener); /** * @deprecated Use getStatus(file).getText()} instead */ - public String getStatusText(VirtualFile file){ + public String getStatusText(@NotNull VirtualFile file){ return getStatus(file).getText(); } /** * @deprecated Use getStatus(file).getColor()} instead */ - public Color getStatusColor(VirtualFile file){ + public Color getStatusColor(@NotNull VirtualFile file){ return getStatus(file).getColor(); } - public abstract Color getNotChangedDirectoryColor(VirtualFile vf); + public abstract Color getNotChangedDirectoryColor(@NotNull VirtualFile vf); } diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/VcsBundle.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/VcsBundle.java index 20cf6cb389fd..531cb653ed63 100644 --- a/platform/platform-api/src/com/intellij/openapi/vcs/VcsBundle.java +++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/VcsBundle.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/platform/core-api/src/com/intellij/psi/util/PsiMatcher.java b/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java index 882643bfde06..0f0f0879f79c 100644 --- a/platform/core-api/src/com/intellij/psi/util/PsiMatcher.java +++ b/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,14 +15,19 @@ */ package com.intellij.psi.util; +import com.intellij.openapi.components.ServiceManager; +import com.intellij.openapi.editor.Editor; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public interface PsiMatcher { - PsiMatcher parent(PsiMatcherExpression e); - PsiMatcher firstChild(PsiMatcherExpression e); - PsiMatcher ancestor(PsiMatcherExpression e); - PsiMatcher descendant(PsiMatcherExpression e); - PsiMatcher dot(PsiMatcherExpression e); +public interface PsiEditorUtil { + @Nullable + Editor findEditorByPsiElement(@NotNull PsiElement element); - PsiElement getElement(); + class Service { + public static PsiEditorUtil getInstance() { + return ServiceManager.getService(PsiEditorUtil.class); + } + } } diff --git a/platform/platform-api/src/com/intellij/ui/PlaceHolder.java b/platform/editor-ui-api/src/com/intellij/ui/PlaceHolder.java index 88f4d0a140fc..0c78ac10ccc6 100644 --- a/platform/platform-api/src/com/intellij/ui/PlaceHolder.java +++ b/platform/editor-ui-api/src/com/intellij/ui/PlaceHolder.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. @@ -15,9 +15,11 @@ */ package com.intellij.ui; +import org.jetbrains.annotations.NotNull; + /** * @author Konstantin Bulenkov */ public interface PlaceHolder<Place> extends PlaceProvider<Place> { - void setPlace(Place place); + void setPlace(@NotNull Place place); } diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/RangeHighlighterEx.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/RangeHighlighterEx.java index abf776ae6b9b..aebfe0a1f329 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/RangeHighlighterEx.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/ex/RangeHighlighterEx.java @@ -30,7 +30,7 @@ import org.jetbrains.annotations.NotNull; public interface RangeHighlighterEx extends RangeHighlighter, RangeMarkerEx { boolean isAfterEndOfLine(); - void setAfterEndOfLine(boolean val); + void setAfterEndOfLine(boolean value); int getAffectedAreaStartOffset(); diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java index 36aa425366f5..50a9922d1bcb 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/MarkupModelImpl.java @@ -66,40 +66,48 @@ public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx @Override @NotNull public RangeHighlighter addLineHighlighter(int lineNumber, int layer, TextAttributes textAttributes) { - if (lineNumber >= getDocument().getLineCount() || lineNumber < 0) { + if (isNotValidLine(lineNumber)) { throw new IndexOutOfBoundsException("lineNumber:" + lineNumber + ". Must be in [0, " + (getDocument().getLineCount() - 1) + "]"); } - // The rationale why we don't bind to the line start offset here is that following: suppose particular breakpoint is hit - // during debugging. We may want to type <enter> at the active line indent and highlighted string will be moved one line - // down as well then. - int offset = getFirstNonspaceCharOffset(getDocument(), lineNumber); - + int offset = getFirstNonSpaceCharOffset(getDocument(), lineNumber); return addRangeHighlighter(offset, offset, layer, textAttributes, HighlighterTargetArea.LINES_IN_RANGE); } @Override + @Nullable public RangeHighlighter addPersistentLineHighlighter(int lineNumber, int layer, TextAttributes textAttributes) { - if (lineNumber >= getDocument().getLineCount() || lineNumber < 0) return null; + if (isNotValidLine(lineNumber)) { + return null; + } + + int offset = getFirstNonSpaceCharOffset(getDocument(), lineNumber); + return addRangeHighlighter(PersistentRangeHighlighterImpl.create(this, offset, layer, HighlighterTargetArea.LINES_IN_RANGE, null, false), null); + } - int offset = getFirstNonspaceCharOffset(getDocument(), lineNumber); + private boolean isNotValidLine(int lineNumber) { + return lineNumber >= getDocument().getLineCount() || lineNumber < 0; + } - return addRangeHighlighterAndChangeAttributes(offset, offset, layer, textAttributes, HighlighterTargetArea.LINES_IN_RANGE, true, null); + // The rationale why we don't bind to the line start offset here is that following: suppose particular breakpoint is hit + // during debugging. We may want to type <enter> at the active line indent and highlighted string will be moved one line + // down as well then. + // IDEA-46403 + public static int getFirstNonSpaceCharOffset(@NotNull Document document, int line) { + int startOffset = document.getLineStartOffset(line); + int endOffset = document.getLineEndOffset(line); + return getFirstNonSpaceCharOffset(document, startOffset, endOffset); } - private static int getFirstNonspaceCharOffset(@NotNull Document doc, int lineNumber) { - int lineStart = doc.getLineStartOffset(lineNumber); - int lineEnd = doc.getLineEndOffset(lineNumber); - CharSequence text = doc.getCharsSequence(); - int offset = lineStart; - for (int i = lineStart; i < lineEnd; i++) { + public static int getFirstNonSpaceCharOffset(@NotNull Document document, int startOffset, int endOffset) { + CharSequence text = document.getImmutableCharSequence(); + for (int i = startOffset; i < endOffset; i++) { char c = text.charAt(i); if (c != ' ' && c != '\t') { - offset = i; - break; + return i; } } - return offset; + return startOffset; } // NB: Can return invalid highlighters @@ -125,15 +133,18 @@ public class MarkupModelImpl extends UserDataHolderBase implements MarkupModelEx @NotNull HighlighterTargetArea targetArea, boolean isPersistent, @Nullable Consumer<RangeHighlighterEx> changeAttributesAction) { - ApplicationManager.getApplication().assertIsDispatchThread(); - RangeHighlighterEx highlighter = isPersistent - ? new PersistentRangeHighlighterImpl(this, startOffset, layer, targetArea, textAttributes) - : new RangeHighlighterImpl(this, startOffset, endOffset, layer, targetArea, textAttributes, false, - false); + return addRangeHighlighter(isPersistent + ? PersistentRangeHighlighterImpl.create(this, startOffset, layer, targetArea, textAttributes, true) + : new RangeHighlighterImpl(this, startOffset, endOffset, layer, targetArea, textAttributes, false, + false), changeAttributesAction); + } + private RangeHighlighterEx addRangeHighlighter(@NotNull RangeHighlighterImpl highlighter, + @Nullable Consumer<RangeHighlighterEx> changeAttributesAction) { + ApplicationManager.getApplication().assertIsDispatchThread(); myCachedHighlighters = null; if (changeAttributesAction != null) { - ((RangeHighlighterImpl)highlighter).changeAttributesNoEvents(changeAttributesAction); + highlighter.changeAttributesNoEvents(changeAttributesAction); } fireAfterAdded(highlighter); return highlighter; diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/PersistentRangeHighlighterImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/PersistentRangeHighlighterImpl.java index 0b67ed593481..50affc1c6d27 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/PersistentRangeHighlighterImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/PersistentRangeHighlighterImpl.java @@ -24,20 +24,33 @@ import com.intellij.openapi.editor.markup.MarkupModel; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.util.diff.FilesTooBigForDiffException; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Implementation of the markup element for the editor and document. * @author max */ class PersistentRangeHighlighterImpl extends RangeHighlighterImpl implements RangeHighlighterEx { - PersistentRangeHighlighterImpl(@NotNull MarkupModel model, - int offset, - int layer, - @NotNull HighlighterTargetArea target, - TextAttributes textAttributes) { - super(model, model.getDocument().getLineStartOffset(model.getDocument().getLineNumber(offset)), model.getDocument().getLineEndOffset(model.getDocument().getLineNumber(offset)),layer, target, textAttributes, - false, false); - setLine(model.getDocument().getLineNumber(offset)); + static PersistentRangeHighlighterImpl create(@NotNull MarkupModel model, + int offset, + int layer, + @NotNull HighlighterTargetArea target, + @Nullable TextAttributes textAttributes, + boolean normalizeStartOffset) { + int line = model.getDocument().getLineNumber(offset); + int startOffset = normalizeStartOffset ? model.getDocument().getLineStartOffset(line) : offset; + return new PersistentRangeHighlighterImpl(model, startOffset, line, layer, target, textAttributes); + } + + private PersistentRangeHighlighterImpl(@NotNull MarkupModel model, + int startOffset, + int line, + int layer, + @NotNull HighlighterTargetArea target, + @Nullable TextAttributes textAttributes) { + super(model, startOffset, model.getDocument().getLineEndOffset(line), layer, target, textAttributes, false, false); + + setLine(line); } @Override @@ -60,7 +73,7 @@ class PersistentRangeHighlighterImpl extends RangeHighlighterImpl implements Ran } } if (isValid() && getTargetArea() == HighlighterTargetArea.LINES_IN_RANGE) { - setIntervalStart(getDocument().getLineStartOffset(getLine())); + setIntervalStart(MarkupModelImpl.getFirstNonSpaceCharOffset(getDocument(), getLine())); setIntervalEnd(getDocument().getLineEndOffset(getLine())); } } @@ -69,7 +82,7 @@ class PersistentRangeHighlighterImpl extends RangeHighlighterImpl implements Ran try { setLine(event.translateLineViaDiff(getLine())); } - catch (FilesTooBigForDiffException e1) { + catch (FilesTooBigForDiffException ignored) { return false; } if (getLine() < 0 || getLine() >= getDocument().getLineCount()) { diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/RangeHighlighterImpl.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/RangeHighlighterImpl.java index fe114feef7d1..ff7c244aeab0 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/RangeHighlighterImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/RangeHighlighterImpl.java @@ -97,6 +97,7 @@ class RangeHighlighterImpl extends RangeMarkerImpl implements RangeHighlighterEx return node == null ? -1 : node.myLayer; } + @NotNull @Override public HighlighterTargetArea getTargetArea() { return getData().getTargetArea(); @@ -209,8 +210,8 @@ class RangeHighlighterImpl extends RangeMarkerImpl implements RangeHighlighterEx } @Override - public void setAfterEndOfLine(boolean afterEndOfLine) { - getData().setAfterEndOfLine(afterEndOfLine); + public void setAfterEndOfLine(boolean value) { + getData().setAfterEndOfLine(value); } @Override diff --git a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/event/MarkupModelListener.java b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/event/MarkupModelListener.java index 4e6074edcf89..83368bfd228a 100644 --- a/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/event/MarkupModelListener.java +++ b/platform/editor-ui-ex/src/com/intellij/openapi/editor/impl/event/MarkupModelListener.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,6 +24,22 @@ public interface MarkupModelListener extends EventListener { MarkupModelListener[] EMPTY_ARRAY = new MarkupModelListener[0]; void afterAdded(@NotNull RangeHighlighterEx highlighter); + void beforeRemoved(@NotNull RangeHighlighterEx highlighter); + void attributesChanged(@NotNull RangeHighlighterEx highlighter, boolean renderersChanged); + + abstract class Adapter implements MarkupModelListener { + @Override + public void afterAdded(@NotNull RangeHighlighterEx highlighter) { + } + + @Override + public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) { + } + + @Override + public void attributesChanged(@NotNull RangeHighlighterEx highlighter, boolean renderersChanged) { + } + } } diff --git a/platform/external-system-impl/resources/icons/task.png b/platform/external-system-impl/resources/icons/task.png Binary files differindex 5afe720a46c0..7e8b5eb705c3 100644 --- a/platform/external-system-impl/resources/icons/task.png +++ b/platform/external-system-impl/resources/icons/task.png diff --git a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java index e0c52255fb58..60cc2411191d 100644 --- a/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.java +++ b/platform/external-system-impl/src/com/intellij/openapi/externalSystem/service/project/manage/ContentRootDataService.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.openapi.externalSystem.service.project.manage; import com.intellij.openapi.diagnostic.Logger; @@ -18,11 +33,10 @@ import com.intellij.openapi.externalSystem.util.Order; import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.*; -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.openapi.vfs.VirtualFileManager; +import com.intellij.util.Consumer; import com.intellij.util.containers.ContainerUtilRt; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes; @@ -31,12 +45,10 @@ import org.jetbrains.jps.model.java.JavaSourceRootProperties; import org.jetbrains.jps.model.java.JavaSourceRootType; import org.jetbrains.jps.model.module.JpsModuleSourceRootType; -import java.io.File; import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Set; /** * Thread-safe. @@ -64,8 +76,7 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat @Override public void importData(@NotNull final Collection<DataNode<ContentRootData>> toImport, @NotNull final Project project, - boolean synchronous) - { + boolean synchronous) { if (toImport.isEmpty()) { return; } @@ -84,72 +95,69 @@ public class ContentRootDataService implements ProjectDataService<ContentRootDat } } - private static void importData(@NotNull final Collection<DataNode<ContentRootData>> datas, + private static void importData(@NotNull final Collection<DataNode<ContentRootData>> data, @NotNull final Module module, - boolean synchronous) - { + boolean synchronous) { ExternalSystemApiUtil.executeProjectChangeAction(synchronous, new DisposeAwareProjectChange(module) { @Override public void execute() { - final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); - final ModifiableRootModel model = moduleRootManager.getModifiableModel(); - final ContentEntry[] contentEntries = model.getContentEntries(); - final Map<String, ContentEntry> contentEntriesMap = ContainerUtilRt.newHashMap(); - for(ContentEntry contentEntry : contentEntries) { - contentEntriesMap.put(contentEntry.getUrl(), contentEntry); - } - - boolean createEmptyContentRootDirectories = false; - if (!datas.isEmpty()) { - ProjectSystemId projectSystemId = datas.iterator().next().getData().getOwner(); - AbstractExternalSystemSettings externalSystemSettings = - ExternalSystemApiUtil.getSettings(module.getProject(), projectSystemId); - - String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY); - if (path != null) { - ExternalProjectSettings projectSettings = externalSystemSettings.getLinkedProjectSettings(path); - createEmptyContentRootDirectories = projectSettings != null && projectSettings.isCreateEmptyContentRootDirectories(); - } - } - - try { - for (final DataNode<ContentRootData> data : datas) { - final ContentRootData contentRoot = data.getData(); - - final ContentEntry contentEntry = findOrCreateContentRoot(model, contentRoot.getRootPath()); - contentEntry.clearExcludeFolders(); - contentEntry.clearSourceFolders(); - LOG.info(String.format("Importing content root '%s' for module '%s'", contentRoot.getRootPath(), module.getName())); - for (String path : contentRoot.getPaths(ExternalSystemSourceType.SOURCE)) { - createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.SOURCE, false, createEmptyContentRootDirectories); - } - for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST)) { - createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, false, createEmptyContentRootDirectories); + ModuleRootModificationUtil.updateModel(module, new Consumer<ModifiableRootModel>() { + @Override + public void consume(ModifiableRootModel model) { + final ContentEntry[] contentEntries = model.getContentEntries(); + final Map<String, ContentEntry> contentEntriesMap = ContainerUtilRt.newHashMap(); + for(ContentEntry contentEntry : contentEntries) { + contentEntriesMap.put(contentEntry.getUrl(), contentEntry); } - for (String path : contentRoot.getPaths(ExternalSystemSourceType.RESOURCE)) { - createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaResourceRootType.RESOURCE, false, createEmptyContentRootDirectories); - } - for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST_RESOURCE)) { - createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaResourceRootType.TEST_RESOURCE, false, createEmptyContentRootDirectories); - } - for (String path : contentRoot.getPaths(ExternalSystemSourceType.SOURCE_GENERATED)) { - createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.SOURCE, true, createEmptyContentRootDirectories); + + boolean createEmptyContentRootDirectories = false; + if (!data.isEmpty()) { + ProjectSystemId projectSystemId = data.iterator().next().getData().getOwner(); + AbstractExternalSystemSettings externalSystemSettings = + ExternalSystemApiUtil.getSettings(module.getProject(), projectSystemId); + + String path = module.getOptionValue(ExternalSystemConstants.ROOT_PROJECT_PATH_KEY); + if (path != null) { + ExternalProjectSettings projectSettings = externalSystemSettings.getLinkedProjectSettings(path); + createEmptyContentRootDirectories = projectSettings != null && projectSettings.isCreateEmptyContentRootDirectories(); + } } - for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST_GENERATED)) { - createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, true, createEmptyContentRootDirectories); + + for (final DataNode<ContentRootData> node : data) { + final ContentRootData contentRoot = node.getData(); + + final ContentEntry contentEntry = findOrCreateContentRoot(model, contentRoot.getRootPath()); + contentEntry.clearExcludeFolders(); + contentEntry.clearSourceFolders(); + LOG.info(String.format("Importing content root '%s' for module '%s'", contentRoot.getRootPath(), module.getName())); + for (String path : contentRoot.getPaths(ExternalSystemSourceType.SOURCE)) { + createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.SOURCE, false, createEmptyContentRootDirectories); + } + for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST)) { + createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, false, createEmptyContentRootDirectories); + } + for (String path : contentRoot.getPaths(ExternalSystemSourceType.RESOURCE)) { + createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaResourceRootType.RESOURCE, false, createEmptyContentRootDirectories); + } + for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST_RESOURCE)) { + createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaResourceRootType.TEST_RESOURCE, false, createEmptyContentRootDirectories); + } + for (String path : contentRoot.getPaths(ExternalSystemSourceType.SOURCE_GENERATED)) { + createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.SOURCE, true, createEmptyContentRootDirectories); + } + for (String path : contentRoot.getPaths(ExternalSystemSourceType.TEST_GENERATED)) { + createSourceRootIfAbsent(contentEntry, path, module.getName(), JavaSourceRootType.TEST_SOURCE, true, createEmptyContentRootDirectories); + } + for (String path : contentRoot.getPaths(ExternalSystemSourceType.EXCLUDED)) { + createExcludedRootIfAbsent(contentEntry, path, module.getName()); + } + contentEntriesMap.remove(contentEntry.getUrl()); } - for (String path : contentRoot.getPaths(ExternalSystemSourceType.EXCLUDED)) { - createExcludedRootIfAbsent(contentEntry, path, module.getName()); + for(ContentEntry contentEntry : contentEntriesMap.values()) { + model.removeContentEntry(contentEntry); } - contentEntriesMap.remove(contentEntry.getUrl()); - } - for(ContentEntry contentEntry : contentEntriesMap.values()) { - model.removeContentEntry(contentEntry); } - } - finally { - model.commit(); - } + }); } }); } diff --git a/platform/icons/src/actions/GroupByModule.png b/platform/icons/src/actions/GroupByModule.png Binary files differindex ec4d538e75c7..0e3b650e0f68 100644 --- a/platform/icons/src/actions/GroupByModule.png +++ b/platform/icons/src/actions/GroupByModule.png diff --git a/platform/icons/src/actions/GroupByModuleGroup.png b/platform/icons/src/actions/GroupByModuleGroup.png Binary files differindex 5f85a0158478..82c852ef6790 100644 --- a/platform/icons/src/actions/GroupByModuleGroup.png +++ b/platform/icons/src/actions/GroupByModuleGroup.png diff --git a/platform/icons/src/actions/GroupByPackage.png b/platform/icons/src/actions/GroupByPackage.png Binary files differindex 5bb3981cf3c2..deaa36ad4637 100644 --- a/platform/icons/src/actions/GroupByPackage.png +++ b/platform/icons/src/actions/GroupByPackage.png diff --git a/platform/icons/src/actions/GroupByPrefix.png b/platform/icons/src/actions/GroupByPrefix.png Binary files differindex c8754bc3570b..0316322a12ef 100644 --- a/platform/icons/src/actions/GroupByPrefix.png +++ b/platform/icons/src/actions/GroupByPrefix.png diff --git a/platform/icons/src/actions/Reset_to_empty.png b/platform/icons/src/actions/Reset_to_empty.png Binary files differindex e53649defd8e..188ad0aa426f 100644 --- a/platform/icons/src/actions/Reset_to_empty.png +++ b/platform/icons/src/actions/Reset_to_empty.png diff --git a/platform/icons/src/actions/addFacesSupport.png b/platform/icons/src/actions/addFacesSupport.png Binary files differindex d0b6cd31c9c1..fab526928d8d 100644 --- a/platform/icons/src/actions/addFacesSupport.png +++ b/platform/icons/src/actions/addFacesSupport.png diff --git a/platform/icons/src/actions/allLeft.png b/platform/icons/src/actions/allLeft.png Binary files differindex f3c7f65a641b..14ab7c076f10 100644 --- a/platform/icons/src/actions/allLeft.png +++ b/platform/icons/src/actions/allLeft.png diff --git a/platform/icons/src/actions/allRight.png b/platform/icons/src/actions/allRight.png Binary files differindex f8df8bacdab6..b2c71392b513 100644 --- a/platform/icons/src/actions/allRight.png +++ b/platform/icons/src/actions/allRight.png diff --git a/platform/icons/src/actions/annotate.png b/platform/icons/src/actions/annotate.png Binary files differindex 92bce565af95..12cad8c7729e 100644 --- a/platform/icons/src/actions/annotate.png +++ b/platform/icons/src/actions/annotate.png diff --git a/platform/icons/src/actions/back.png b/platform/icons/src/actions/back.png Binary files differindex f33a6ad2cede..eca44809f824 100644 --- a/platform/icons/src/actions/back.png +++ b/platform/icons/src/actions/back.png diff --git a/platform/icons/src/actions/browser-externalJavaDoc.png b/platform/icons/src/actions/browser-externalJavaDoc.png Binary files differindex d7e4ee6fbc99..704406857f38 100644 --- a/platform/icons/src/actions/browser-externalJavaDoc.png +++ b/platform/icons/src/actions/browser-externalJavaDoc.png diff --git a/platform/icons/src/actions/cancel.png b/platform/icons/src/actions/cancel.png Binary files differindex 721c469e6172..c6ff278b556f 100644 --- a/platform/icons/src/actions/cancel.png +++ b/platform/icons/src/actions/cancel.png diff --git a/platform/icons/src/actions/checkOut.png b/platform/icons/src/actions/checkOut.png Binary files differindex fccb0baca876..1dd71ca39f8e 100644 --- a/platform/icons/src/actions/checkOut.png +++ b/platform/icons/src/actions/checkOut.png diff --git a/platform/icons/src/actions/checked.png b/platform/icons/src/actions/checked.png Binary files differindex 68ef20a3456c..1de39421bc90 100644 --- a/platform/icons/src/actions/checked.png +++ b/platform/icons/src/actions/checked.png diff --git a/platform/icons/src/actions/checked_selected.png b/platform/icons/src/actions/checked_selected.png Binary files differindex a81060ee53e1..4c756e21131a 100644 --- a/platform/icons/src/actions/checked_selected.png +++ b/platform/icons/src/actions/checked_selected.png diff --git a/platform/icons/src/actions/checked_small.png b/platform/icons/src/actions/checked_small.png Binary files differindex fdf62ea2715d..eaf1718e664b 100644 --- a/platform/icons/src/actions/checked_small.png +++ b/platform/icons/src/actions/checked_small.png diff --git a/platform/icons/src/actions/checked_small_selected.png b/platform/icons/src/actions/checked_small_selected.png Binary files differindex c5d048b2c312..c66b54341bc7 100644 --- a/platform/icons/src/actions/checked_small_selected.png +++ b/platform/icons/src/actions/checked_small_selected.png diff --git a/platform/icons/src/actions/clean.png b/platform/icons/src/actions/clean.png Binary files differindex 6444138e5fcd..30f88bc75df0 100644 --- a/platform/icons/src/actions/clean.png +++ b/platform/icons/src/actions/clean.png diff --git a/platform/icons/src/actions/cleanLight.png b/platform/icons/src/actions/cleanLight.png Binary files differindex 1156231face5..3e368d4ea8f1 100644 --- a/platform/icons/src/actions/cleanLight.png +++ b/platform/icons/src/actions/cleanLight.png diff --git a/platform/icons/src/actions/closeHovered.png b/platform/icons/src/actions/closeHovered.png Binary files differindex 95efb3c42ac0..5c2b1fd66ff1 100644 --- a/platform/icons/src/actions/closeHovered.png +++ b/platform/icons/src/actions/closeHovered.png diff --git a/platform/icons/src/actions/closeNew.png b/platform/icons/src/actions/closeNew.png Binary files differindex fdbee9a5310b..c5f4c69877c3 100644 --- a/platform/icons/src/actions/closeNew.png +++ b/platform/icons/src/actions/closeNew.png diff --git a/platform/icons/src/actions/closeNewHovered.png b/platform/icons/src/actions/closeNewHovered.png Binary files differindex aff734628926..155a0bbf021e 100644 --- a/platform/icons/src/actions/closeNewHovered.png +++ b/platform/icons/src/actions/closeNewHovered.png diff --git a/platform/icons/src/actions/collapseall.png b/platform/icons/src/actions/collapseall.png Binary files differindex d8a6f198249b..e838f6532765 100644 --- a/platform/icons/src/actions/collapseall.png +++ b/platform/icons/src/actions/collapseall.png diff --git a/platform/icons/src/actions/commit.png b/platform/icons/src/actions/commit.png Binary files differindex db9995516937..fbebab84e123 100644 --- a/platform/icons/src/actions/commit.png +++ b/platform/icons/src/actions/commit.png diff --git a/platform/icons/src/actions/compile.png b/platform/icons/src/actions/compile.png Binary files differindex 2adafae126fa..d0e4c9fa8829 100644 --- a/platform/icons/src/actions/compile.png +++ b/platform/icons/src/actions/compile.png diff --git a/platform/icons/src/actions/copy.png b/platform/icons/src/actions/copy.png Binary files differindex 8f13765d5eff..a881c31bab0c 100644 --- a/platform/icons/src/actions/copy.png +++ b/platform/icons/src/actions/copy.png diff --git a/platform/icons/src/actions/createFromUsage.png b/platform/icons/src/actions/createFromUsage.png Binary files differindex a3bfb2ac03db..e3d4abf91fe9 100644 --- a/platform/icons/src/actions/createFromUsage.png +++ b/platform/icons/src/actions/createFromUsage.png diff --git a/platform/icons/src/actions/createPatch.png b/platform/icons/src/actions/createPatch.png Binary files differindex 748a07ec96f5..4864813293d1 100644 --- a/platform/icons/src/actions/createPatch.png +++ b/platform/icons/src/actions/createPatch.png diff --git a/platform/icons/src/actions/cross.png b/platform/icons/src/actions/cross.png Binary files differindex 5994bd641f16..a4e9b8df5fed 100644 --- a/platform/icons/src/actions/cross.png +++ b/platform/icons/src/actions/cross.png diff --git a/platform/icons/src/actions/delete.png b/platform/icons/src/actions/delete.png Binary files differindex 0df8623d59db..c6ff278b556f 100644 --- a/platform/icons/src/actions/delete.png +++ b/platform/icons/src/actions/delete.png diff --git a/platform/icons/src/actions/diff.png b/platform/icons/src/actions/diff.png Binary files differindex fc74b9203103..5addd2e2ed6f 100644 --- a/platform/icons/src/actions/diff.png +++ b/platform/icons/src/actions/diff.png diff --git a/platform/icons/src/actions/diffWithCurrent.png b/platform/icons/src/actions/diffWithCurrent.png Binary files differindex 7ef53f380153..84c4874f30a1 100644 --- a/platform/icons/src/actions/diffWithCurrent.png +++ b/platform/icons/src/actions/diffWithCurrent.png diff --git a/platform/icons/src/actions/down.png b/platform/icons/src/actions/down.png Binary files differindex 1eba24f5449a..ffc1b211a8f4 100644 --- a/platform/icons/src/actions/down.png +++ b/platform/icons/src/actions/down.png diff --git a/platform/icons/src/actions/download.png b/platform/icons/src/actions/download.png Binary files differindex efbb8808d578..3df555ee6a48 100644 --- a/platform/icons/src/actions/download.png +++ b/platform/icons/src/actions/download.png diff --git a/platform/icons/src/actions/dump.png b/platform/icons/src/actions/dump.png Binary files differindex 3abd89c80cab..4da39fdec3a8 100644 --- a/platform/icons/src/actions/dump.png +++ b/platform/icons/src/actions/dump.png diff --git a/platform/icons/src/actions/edit.png b/platform/icons/src/actions/edit.png Binary files differindex 5629d907fb22..9c789f1ff2b2 100644 --- a/platform/icons/src/actions/edit.png +++ b/platform/icons/src/actions/edit.png diff --git a/platform/icons/src/actions/editSource.png b/platform/icons/src/actions/editSource.png Binary files differindex a4195edbc02f..047f5c598a28 100644 --- a/platform/icons/src/actions/editSource.png +++ b/platform/icons/src/actions/editSource.png diff --git a/platform/icons/src/actions/erDiagram.png b/platform/icons/src/actions/erDiagram.png Binary files differindex b640d77ada6d..23c16425fd5b 100644 --- a/platform/icons/src/actions/erDiagram.png +++ b/platform/icons/src/actions/erDiagram.png diff --git a/platform/icons/src/actions/exclude.png b/platform/icons/src/actions/exclude.png Binary files differindex 4a6ce012324a..32644b6d31cb 100644 --- a/platform/icons/src/actions/exclude.png +++ b/platform/icons/src/actions/exclude.png diff --git a/platform/icons/src/actions/execute.png b/platform/icons/src/actions/execute.png Binary files differindex c1743248d995..7204a207b89f 100644 --- a/platform/icons/src/actions/execute.png +++ b/platform/icons/src/actions/execute.png diff --git a/platform/icons/src/actions/exit.png b/platform/icons/src/actions/exit.png Binary files differindex cabe4872686d..09dca5336f0a 100644 --- a/platform/icons/src/actions/exit.png +++ b/platform/icons/src/actions/exit.png diff --git a/platform/icons/src/actions/expandall.png b/platform/icons/src/actions/expandall.png Binary files differindex d70b48224c72..0b78ca15d4e8 100644 --- a/platform/icons/src/actions/expandall.png +++ b/platform/icons/src/actions/expandall.png diff --git a/platform/icons/src/actions/export.png b/platform/icons/src/actions/export.png Binary files differindex 01975b7c8134..58138a9fae2b 100644 --- a/platform/icons/src/actions/export.png +++ b/platform/icons/src/actions/export.png diff --git a/platform/icons/src/actions/filter_small.png b/platform/icons/src/actions/filter_small.png Binary files differindex 133b40fc7330..f023bbe5f438 100644 --- a/platform/icons/src/actions/filter_small.png +++ b/platform/icons/src/actions/filter_small.png diff --git a/platform/icons/src/actions/find.png b/platform/icons/src/actions/find.png Binary files differindex ac79c5dd83bd..a3b90b1a9ed5 100644 --- a/platform/icons/src/actions/find.png +++ b/platform/icons/src/actions/find.png diff --git a/platform/icons/src/actions/findPlain.png b/platform/icons/src/actions/findPlain.png Binary files differindex a33c774442e5..8514cde05f77 100644 --- a/platform/icons/src/actions/findPlain.png +++ b/platform/icons/src/actions/findPlain.png diff --git a/platform/icons/src/actions/findWhite.png b/platform/icons/src/actions/findWhite.png Binary files differindex 528960e8803d..b2a65f4f6d22 100644 --- a/platform/icons/src/actions/findWhite.png +++ b/platform/icons/src/actions/findWhite.png diff --git a/platform/icons/src/actions/forceRefresh.png b/platform/icons/src/actions/forceRefresh.png Binary files differindex 0020652a9407..a3a908bca368 100644 --- a/platform/icons/src/actions/forceRefresh.png +++ b/platform/icons/src/actions/forceRefresh.png diff --git a/platform/icons/src/actions/forward.png b/platform/icons/src/actions/forward.png Binary files differindex 1b5de9f39ab3..7d1843cf01ff 100644 --- a/platform/icons/src/actions/forward.png +++ b/platform/icons/src/actions/forward.png diff --git a/platform/icons/src/actions/gc.png b/platform/icons/src/actions/gc.png Binary files differindex f3936b91c9eb..7581ffbcbee4 100644 --- a/platform/icons/src/actions/gc.png +++ b/platform/icons/src/actions/gc.png diff --git a/platform/icons/src/actions/get.png b/platform/icons/src/actions/get.png Binary files differindex 8ae802cc296c..df4291916520 100644 --- a/platform/icons/src/actions/get.png +++ b/platform/icons/src/actions/get.png diff --git a/platform/icons/src/actions/groupByMethod.png b/platform/icons/src/actions/groupByMethod.png Binary files differindex ce06d20c18b3..5947bacc4f11 100644 --- a/platform/icons/src/actions/groupByMethod.png +++ b/platform/icons/src/actions/groupByMethod.png diff --git a/platform/icons/src/actions/groupByTestProduction.png b/platform/icons/src/actions/groupByTestProduction.png Binary files differindex 8cb94075d3c2..b6b60c4734d5 100644 --- a/platform/icons/src/actions/groupByTestProduction.png +++ b/platform/icons/src/actions/groupByTestProduction.png diff --git a/platform/icons/src/actions/help.png b/platform/icons/src/actions/help.png Binary files differindex 50e06fb595af..d6d15ab71d50 100644 --- a/platform/icons/src/actions/help.png +++ b/platform/icons/src/actions/help.png diff --git a/platform/icons/src/actions/install.png b/platform/icons/src/actions/install.png Binary files differindex 69733cf920c8..7ecfe7c110d9 100644 --- a/platform/icons/src/actions/install.png +++ b/platform/icons/src/actions/install.png diff --git a/platform/icons/src/actions/intentionBulb.png b/platform/icons/src/actions/intentionBulb.png Binary files differindex a3bfb2ac03db..e3d4abf91fe9 100644 --- a/platform/icons/src/actions/intentionBulb.png +++ b/platform/icons/src/actions/intentionBulb.png diff --git a/platform/icons/src/actions/left.png b/platform/icons/src/actions/left.png Binary files differindex 7b1248bd9ba1..39b9621abe2e 100644 --- a/platform/icons/src/actions/left.png +++ b/platform/icons/src/actions/left.png diff --git a/platform/icons/src/actions/lightning.png b/platform/icons/src/actions/lightning.png Binary files differindex a93fc4e8b2ae..2c51687998da 100644 --- a/platform/icons/src/actions/lightning.png +++ b/platform/icons/src/actions/lightning.png diff --git a/platform/icons/src/actions/menu-cut.png b/platform/icons/src/actions/menu-cut.png Binary files differindex 721b2f7da986..8c26d86c0217 100644 --- a/platform/icons/src/actions/menu-cut.png +++ b/platform/icons/src/actions/menu-cut.png diff --git a/platform/icons/src/actions/menu-find.png b/platform/icons/src/actions/menu-find.png Binary files differindex 9861cfe7eb68..37a21b96d339 100644 --- a/platform/icons/src/actions/menu-find.png +++ b/platform/icons/src/actions/menu-find.png diff --git a/platform/icons/src/actions/menu-help.png b/platform/icons/src/actions/menu-help.png Binary files differindex 0b7e547ee94d..d6d15ab71d50 100644 --- a/platform/icons/src/actions/menu-help.png +++ b/platform/icons/src/actions/menu-help.png diff --git a/platform/icons/src/actions/menu-open.png b/platform/icons/src/actions/menu-open.png Binary files differindex 996b47dba167..cf798dcfad09 100644 --- a/platform/icons/src/actions/menu-open.png +++ b/platform/icons/src/actions/menu-open.png diff --git a/platform/icons/src/actions/menu-paste.png b/platform/icons/src/actions/menu-paste.png Binary files differindex edccca84534d..c488ce614337 100644 --- a/platform/icons/src/actions/menu-paste.png +++ b/platform/icons/src/actions/menu-paste.png diff --git a/platform/icons/src/actions/menu-replace.png b/platform/icons/src/actions/menu-replace.png Binary files differindex 9c0967a70bfc..f824b831786f 100644 --- a/platform/icons/src/actions/menu-replace.png +++ b/platform/icons/src/actions/menu-replace.png diff --git a/platform/icons/src/actions/menu-saveall.png b/platform/icons/src/actions/menu-saveall.png Binary files differindex 9d7861c720d3..40edbf158772 100644 --- a/platform/icons/src/actions/menu-saveall.png +++ b/platform/icons/src/actions/menu-saveall.png diff --git a/platform/icons/src/actions/minimize.png b/platform/icons/src/actions/minimize.png Binary files differindex 77f2ef32253d..722cfe08b3da 100644 --- a/platform/icons/src/actions/minimize.png +++ b/platform/icons/src/actions/minimize.png diff --git a/platform/icons/src/actions/module.png b/platform/icons/src/actions/module.png Binary files differindex 7d2508175684..03395f08895c 100644 --- a/platform/icons/src/actions/module.png +++ b/platform/icons/src/actions/module.png diff --git a/platform/icons/src/actions/move-to-button-top.png b/platform/icons/src/actions/move-to-button-top.png Binary files differindex 8741ec956da3..746fdd0ff9c9 100644 --- a/platform/icons/src/actions/move-to-button-top.png +++ b/platform/icons/src/actions/move-to-button-top.png diff --git a/platform/icons/src/actions/move-to-button.png b/platform/icons/src/actions/move-to-button.png Binary files differindex 57a187e206e7..c91fdc8cea4a 100644 --- a/platform/icons/src/actions/move-to-button.png +++ b/platform/icons/src/actions/move-to-button.png diff --git a/platform/icons/src/actions/moveDown.png b/platform/icons/src/actions/moveDown.png Binary files differindex 0b398dd7e8fa..2380fb5e4555 100644 --- a/platform/icons/src/actions/moveDown.png +++ b/platform/icons/src/actions/moveDown.png diff --git a/platform/icons/src/actions/moveToAnotherChangelist.png b/platform/icons/src/actions/moveToAnotherChangelist.png Binary files differindex c41c435b0b33..f085c1c974d9 100644 --- a/platform/icons/src/actions/moveToAnotherChangelist.png +++ b/platform/icons/src/actions/moveToAnotherChangelist.png diff --git a/platform/icons/src/actions/moveUp.png b/platform/icons/src/actions/moveUp.png Binary files differindex 3079aa6361eb..4795103cd98c 100644 --- a/platform/icons/src/actions/moveUp.png +++ b/platform/icons/src/actions/moveUp.png diff --git a/platform/icons/src/actions/new.png b/platform/icons/src/actions/new.png Binary files differindex 8148950c0cdf..0628e74f5c1c 100644 --- a/platform/icons/src/actions/new.png +++ b/platform/icons/src/actions/new.png diff --git a/platform/icons/src/actions/newFolder.png b/platform/icons/src/actions/newFolder.png Binary files differindex d2ad99cf68dc..1001251dbf72 100644 --- a/platform/icons/src/actions/newFolder.png +++ b/platform/icons/src/actions/newFolder.png diff --git a/platform/icons/src/actions/nextOccurence.png b/platform/icons/src/actions/nextOccurence.png Binary files differindex 2291232322a0..423f2e53c673 100644 --- a/platform/icons/src/actions/nextOccurence.png +++ b/platform/icons/src/actions/nextOccurence.png diff --git a/platform/icons/src/actions/nextfile.png b/platform/icons/src/actions/nextfile.png Binary files differindex 87ee02d4d65f..0cb864f6832e 100644 --- a/platform/icons/src/actions/nextfile.png +++ b/platform/icons/src/actions/nextfile.png diff --git a/platform/icons/src/actions/pause.png b/platform/icons/src/actions/pause.png Binary files differindex ecfe1e402b5b..dad15273bf9a 100644 --- a/platform/icons/src/actions/pause.png +++ b/platform/icons/src/actions/pause.png diff --git a/platform/icons/src/actions/popFrame.png b/platform/icons/src/actions/popFrame.png Binary files differindex 69d8f9e2bfe9..ab8f34f2b85f 100644 --- a/platform/icons/src/actions/popFrame.png +++ b/platform/icons/src/actions/popFrame.png diff --git a/platform/icons/src/actions/prevfile.png b/platform/icons/src/actions/prevfile.png Binary files differindex d5de66649c79..ce718332828a 100644 --- a/platform/icons/src/actions/prevfile.png +++ b/platform/icons/src/actions/prevfile.png diff --git a/platform/icons/src/actions/preview.png b/platform/icons/src/actions/preview.png Binary files differindex c84386e35792..1d66096788fd 100644 --- a/platform/icons/src/actions/preview.png +++ b/platform/icons/src/actions/preview.png diff --git a/platform/icons/src/actions/previewDetails.png b/platform/icons/src/actions/previewDetails.png Binary files differindex 5fef9cbea043..72af3ab555eb 100644 --- a/platform/icons/src/actions/previewDetails.png +++ b/platform/icons/src/actions/previewDetails.png diff --git a/platform/icons/src/actions/previousOccurence.png b/platform/icons/src/actions/previousOccurence.png Binary files differindex ce4ec6b38cce..4795103cd98c 100644 --- a/platform/icons/src/actions/previousOccurence.png +++ b/platform/icons/src/actions/previousOccurence.png diff --git a/platform/icons/src/actions/profileCPU.png b/platform/icons/src/actions/profileCPU.png Binary files differindex 3990fef712d3..5b2f52fcb00a 100644 --- a/platform/icons/src/actions/profileCPU.png +++ b/platform/icons/src/actions/profileCPU.png diff --git a/platform/icons/src/actions/profileMemory.png b/platform/icons/src/actions/profileMemory.png Binary files differindex 9bd7b7c7a201..bb7d51cabfd4 100644 --- a/platform/icons/src/actions/profileMemory.png +++ b/platform/icons/src/actions/profileMemory.png diff --git a/platform/icons/src/actions/properties.png b/platform/icons/src/actions/properties.png Binary files differindex 188c459844ba..a1373e42ebb0 100644 --- a/platform/icons/src/actions/properties.png +++ b/platform/icons/src/actions/properties.png diff --git a/platform/icons/src/actions/quickList.png b/platform/icons/src/actions/quickList.png Binary files differindex fc57efdf7871..940576b77e89 100644 --- a/platform/icons/src/actions/quickList.png +++ b/platform/icons/src/actions/quickList.png diff --git a/platform/icons/src/actions/quickfixBulb.png b/platform/icons/src/actions/quickfixBulb.png Binary files differindex b6d1feef3719..ecc6c160ac5a 100644 --- a/platform/icons/src/actions/quickfixBulb.png +++ b/platform/icons/src/actions/quickfixBulb.png diff --git a/platform/icons/src/actions/quickfixOffBulb.png b/platform/icons/src/actions/quickfixOffBulb.png Binary files differindex ab4fedfcda41..eb588a40ead6 100644 --- a/platform/icons/src/actions/quickfixOffBulb.png +++ b/platform/icons/src/actions/quickfixOffBulb.png diff --git a/platform/icons/src/actions/realIntentionBulb.png b/platform/icons/src/actions/realIntentionBulb.png Binary files differindex 3a60ce958e0c..fa28757bd7b0 100644 --- a/platform/icons/src/actions/realIntentionBulb.png +++ b/platform/icons/src/actions/realIntentionBulb.png diff --git a/platform/icons/src/actions/realIntentionOffBulb.png b/platform/icons/src/actions/realIntentionOffBulb.png Binary files differindex caf6eb131b0e..655b3093c7f5 100644 --- a/platform/icons/src/actions/realIntentionOffBulb.png +++ b/platform/icons/src/actions/realIntentionOffBulb.png diff --git a/platform/icons/src/actions/redo.png b/platform/icons/src/actions/redo.png Binary files differindex 0de2b708182f..8254518421ef 100644 --- a/platform/icons/src/actions/redo.png +++ b/platform/icons/src/actions/redo.png diff --git a/platform/icons/src/actions/refactoringBulb.png b/platform/icons/src/actions/refactoringBulb.png Binary files differindex 342a95abee7b..dbfe3bb738a7 100644 --- a/platform/icons/src/actions/refactoringBulb.png +++ b/platform/icons/src/actions/refactoringBulb.png diff --git a/platform/icons/src/actions/refresh.png b/platform/icons/src/actions/refresh.png Binary files differindex d842736514bd..d595f6b42f56 100644 --- a/platform/icons/src/actions/refresh.png +++ b/platform/icons/src/actions/refresh.png diff --git a/platform/icons/src/actions/replace.png b/platform/icons/src/actions/replace.png Binary files differindex 9c0967a70bfc..f824b831786f 100644 --- a/platform/icons/src/actions/replace.png +++ b/platform/icons/src/actions/replace.png diff --git a/platform/icons/src/actions/rerun.png b/platform/icons/src/actions/rerun.png Binary files differindex e6fd3329fb23..06acf53c6cc4 100644 --- a/platform/icons/src/actions/rerun.png +++ b/platform/icons/src/actions/rerun.png diff --git a/platform/icons/src/actions/reset.png b/platform/icons/src/actions/reset.png Binary files differindex 5c5ebaba62a1..bc8e5a299d0e 100644 --- a/platform/icons/src/actions/reset.png +++ b/platform/icons/src/actions/reset.png diff --git a/platform/icons/src/actions/restart.png b/platform/icons/src/actions/restart.png Binary files differindex d44c69876968..deadeb5b9d6c 100644 --- a/platform/icons/src/actions/restart.png +++ b/platform/icons/src/actions/restart.png diff --git a/platform/icons/src/actions/resume.png b/platform/icons/src/actions/resume.png Binary files differindex 2c9edba5982b..9355db4b2de6 100644 --- a/platform/icons/src/actions/resume.png +++ b/platform/icons/src/actions/resume.png diff --git a/platform/icons/src/actions/right.png b/platform/icons/src/actions/right.png Binary files differindex e2b97679a621..e803d24b9615 100644 --- a/platform/icons/src/actions/right.png +++ b/platform/icons/src/actions/right.png diff --git a/platform/icons/src/actions/rollback.png b/platform/icons/src/actions/rollback.png Binary files differindex 501bcd0c8538..42710012edb7 100644 --- a/platform/icons/src/actions/rollback.png +++ b/platform/icons/src/actions/rollback.png diff --git a/platform/icons/src/actions/runToCursor.png b/platform/icons/src/actions/runToCursor.png Binary files differindex 213a13d5ceae..aa9a263157c0 100644 --- a/platform/icons/src/actions/runToCursor.png +++ b/platform/icons/src/actions/runToCursor.png diff --git a/platform/icons/src/actions/search.png b/platform/icons/src/actions/search.png Binary files differindex 5af991bf9d84..2b2b1b9c48e3 100644 --- a/platform/icons/src/actions/search.png +++ b/platform/icons/src/actions/search.png diff --git a/platform/icons/src/actions/selectall.png b/platform/icons/src/actions/selectall.png Binary files differindex 515bbd1d02be..c85f1f6d8ed4 100644 --- a/platform/icons/src/actions/selectall.png +++ b/platform/icons/src/actions/selectall.png diff --git a/platform/icons/src/actions/share.png b/platform/icons/src/actions/share.png Binary files differindex e4348f7dcab5..bf9510bf84d8 100644 --- a/platform/icons/src/actions/share.png +++ b/platform/icons/src/actions/share.png diff --git a/platform/icons/src/actions/shortcutFilter.png b/platform/icons/src/actions/shortcutFilter.png Binary files differindex 49680c14806c..c21d108c20cc 100644 --- a/platform/icons/src/actions/shortcutFilter.png +++ b/platform/icons/src/actions/shortcutFilter.png diff --git a/platform/icons/src/actions/showAsTree.png b/platform/icons/src/actions/showAsTree.png Binary files differindex e1b5bcece78b..7a2e3451fa35 100644 --- a/platform/icons/src/actions/showAsTree.png +++ b/platform/icons/src/actions/showAsTree.png diff --git a/platform/icons/src/actions/showChangesOnly.png b/platform/icons/src/actions/showChangesOnly.png Binary files differindex 8c96a902bcb3..3c7acf060000 100644 --- a/platform/icons/src/actions/showChangesOnly.png +++ b/platform/icons/src/actions/showChangesOnly.png diff --git a/platform/icons/src/actions/showHiddens.png b/platform/icons/src/actions/showHiddens.png Binary files differindex 4d8c667ea5e8..2eb4bbc08262 100644 --- a/platform/icons/src/actions/showHiddens.png +++ b/platform/icons/src/actions/showHiddens.png diff --git a/platform/icons/src/actions/showImportStatements.png b/platform/icons/src/actions/showImportStatements.png Binary files differindex 085d29377a23..3f66914e1e69 100644 --- a/platform/icons/src/actions/showImportStatements.png +++ b/platform/icons/src/actions/showImportStatements.png diff --git a/platform/icons/src/actions/showReadAccess.png b/platform/icons/src/actions/showReadAccess.png Binary files differindex 4fcf47f28fe3..ae60fdbda51d 100644 --- a/platform/icons/src/actions/showReadAccess.png +++ b/platform/icons/src/actions/showReadAccess.png diff --git a/platform/icons/src/actions/showWriteAccess.png b/platform/icons/src/actions/showWriteAccess.png Binary files differindex ca39dd1b924a..81e46faf74e6 100644 --- a/platform/icons/src/actions/showWriteAccess.png +++ b/platform/icons/src/actions/showWriteAccess.png diff --git a/platform/icons/src/actions/sortAsc.png b/platform/icons/src/actions/sortAsc.png Binary files differindex 90a63224c8b3..2fe4cc9d4fdc 100644 --- a/platform/icons/src/actions/sortAsc.png +++ b/platform/icons/src/actions/sortAsc.png diff --git a/platform/icons/src/actions/sortDesc.png b/platform/icons/src/actions/sortDesc.png Binary files differindex 63ee7ca4b47f..99224eeae535 100644 --- a/platform/icons/src/actions/sortDesc.png +++ b/platform/icons/src/actions/sortDesc.png diff --git a/platform/icons/src/actions/splitHorizontally.png b/platform/icons/src/actions/splitHorizontally.png Binary files differindex b696e9d46d69..29c2c0ac80a5 100644 --- a/platform/icons/src/actions/splitHorizontally.png +++ b/platform/icons/src/actions/splitHorizontally.png diff --git a/platform/icons/src/actions/splitVertically.png b/platform/icons/src/actions/splitVertically.png Binary files differindex c0a1b7edde56..d14afaeb7eae 100644 --- a/platform/icons/src/actions/splitVertically.png +++ b/platform/icons/src/actions/splitVertically.png diff --git a/platform/icons/src/actions/startDebugger.png b/platform/icons/src/actions/startDebugger.png Binary files differindex c5c36bcfcfdc..d31a806ccf04 100644 --- a/platform/icons/src/actions/startDebugger.png +++ b/platform/icons/src/actions/startDebugger.png diff --git a/platform/icons/src/actions/stepOut.png b/platform/icons/src/actions/stepOut.png Binary files differindex 0322ede64efa..4ea29bcfd92b 100644 --- a/platform/icons/src/actions/stepOut.png +++ b/platform/icons/src/actions/stepOut.png diff --git a/platform/icons/src/actions/submit1.png b/platform/icons/src/actions/submit1.png Binary files differindex 331803f5e90f..49dd012f9f46 100644 --- a/platform/icons/src/actions/submit1.png +++ b/platform/icons/src/actions/submit1.png diff --git a/platform/icons/src/actions/swapPanels.png b/platform/icons/src/actions/swapPanels.png Binary files differindex 6484cdedfea3..98b974b8a9ca 100644 --- a/platform/icons/src/actions/swapPanels.png +++ b/platform/icons/src/actions/swapPanels.png diff --git a/platform/icons/src/actions/syncPanels.png b/platform/icons/src/actions/syncPanels.png Binary files differindex 958149a866f1..0357418471d4 100644 --- a/platform/icons/src/actions/syncPanels.png +++ b/platform/icons/src/actions/syncPanels.png diff --git a/platform/icons/src/actions/toggleSoftWrap.png b/platform/icons/src/actions/toggleSoftWrap.png Binary files differindex 2ef5505ddb6a..880d121e6a51 100644 --- a/platform/icons/src/actions/toggleSoftWrap.png +++ b/platform/icons/src/actions/toggleSoftWrap.png diff --git a/platform/icons/src/actions/traceInto.png b/platform/icons/src/actions/traceInto.png Binary files differindex 2b72d2982161..138dda98bdf2 100644 --- a/platform/icons/src/actions/traceInto.png +++ b/platform/icons/src/actions/traceInto.png diff --git a/platform/icons/src/actions/traceOver.png b/platform/icons/src/actions/traceOver.png Binary files differindex e78bddab632b..082de1ffd2ad 100644 --- a/platform/icons/src/actions/traceOver.png +++ b/platform/icons/src/actions/traceOver.png diff --git a/platform/icons/src/actions/undo.png b/platform/icons/src/actions/undo.png Binary files differindex cd6a8eb97408..c237634b04d2 100644 --- a/platform/icons/src/actions/undo.png +++ b/platform/icons/src/actions/undo.png diff --git a/platform/icons/src/actions/uninstall.png b/platform/icons/src/actions/uninstall.png Binary files differindex 4555fe0ea957..61b925a8c19f 100644 --- a/platform/icons/src/actions/uninstall.png +++ b/platform/icons/src/actions/uninstall.png diff --git a/platform/icons/src/actions/unselectall.png b/platform/icons/src/actions/unselectall.png Binary files differindex 59b4ae1f6d59..a8172d201bea 100644 --- a/platform/icons/src/actions/unselectall.png +++ b/platform/icons/src/actions/unselectall.png diff --git a/platform/icons/src/actions/unshare.png b/platform/icons/src/actions/unshare.png Binary files differindex d7d977a54e16..260944a590be 100644 --- a/platform/icons/src/actions/unshare.png +++ b/platform/icons/src/actions/unshare.png diff --git a/platform/icons/src/actions/up.png b/platform/icons/src/actions/up.png Binary files differindex a221498bfc1c..6966ee299801 100644 --- a/platform/icons/src/actions/up.png +++ b/platform/icons/src/actions/up.png diff --git a/platform/icons/src/css/atrule.png b/platform/icons/src/css/atrule.png Binary files differindex dbd01ebb9df0..63115e4d2108 100644 --- a/platform/icons/src/css/atrule.png +++ b/platform/icons/src/css/atrule.png diff --git a/platform/icons/src/css/import.png b/platform/icons/src/css/import.png Binary files differindex dff0ef23a78c..7cd984dbf933 100644 --- a/platform/icons/src/css/import.png +++ b/platform/icons/src/css/import.png diff --git a/platform/icons/src/css/property.png b/platform/icons/src/css/property.png Binary files differindex 8d978378ace0..53ced05710b7 100755 --- a/platform/icons/src/css/property.png +++ b/platform/icons/src/css/property.png diff --git a/platform/icons/src/css/pseudo-element.png b/platform/icons/src/css/pseudo-element.png Binary files differindex 45eb3f63b9ae..5d96d962ec1d 100755 --- a/platform/icons/src/css/pseudo-element.png +++ b/platform/icons/src/css/pseudo-element.png diff --git a/platform/icons/src/darcula/doubleComboArrow.png b/platform/icons/src/darcula/doubleComboArrow.png Binary files differindex 25d4110aef1e..132914775bc5 100644 --- a/platform/icons/src/darcula/doubleComboArrow.png +++ b/platform/icons/src/darcula/doubleComboArrow.png diff --git a/platform/icons/src/darcula/treeNodeCollapsed.png b/platform/icons/src/darcula/treeNodeCollapsed.png Binary files differindex 0ee3911d6cd6..31595a0bd215 100644 --- a/platform/icons/src/darcula/treeNodeCollapsed.png +++ b/platform/icons/src/darcula/treeNodeCollapsed.png diff --git a/platform/icons/src/darcula/treeNodeExpanded.png b/platform/icons/src/darcula/treeNodeExpanded.png Binary files differindex 76db8ca3fa18..8961ba085d15 100644 --- a/platform/icons/src/darcula/treeNodeExpanded.png +++ b/platform/icons/src/darcula/treeNodeExpanded.png diff --git a/platform/icons/src/debugger/actions/force_run_to_cursor.png b/platform/icons/src/debugger/actions/force_run_to_cursor.png Binary files differindex ac4257c28169..353a0f281a65 100644 --- a/platform/icons/src/debugger/actions/force_run_to_cursor.png +++ b/platform/icons/src/debugger/actions/force_run_to_cursor.png diff --git a/platform/icons/src/debugger/actions/force_step_into.png b/platform/icons/src/debugger/actions/force_step_into.png Binary files differindex 097c92a8b7ad..39b390bc2873 100644 --- a/platform/icons/src/debugger/actions/force_step_into.png +++ b/platform/icons/src/debugger/actions/force_step_into.png diff --git a/platform/icons/src/debugger/actions/force_step_over.png b/platform/icons/src/debugger/actions/force_step_over.png Binary files differindex b1353864382c..aa864b0f6e46 100644 --- a/platform/icons/src/debugger/actions/force_step_over.png +++ b/platform/icons/src/debugger/actions/force_step_over.png diff --git a/platform/icons/src/debugger/addToWatch.png b/platform/icons/src/debugger/addToWatch.png Binary files differindex 3fb8e009c2d2..9cc94a5b5faf 100644 --- a/platform/icons/src/debugger/addToWatch.png +++ b/platform/icons/src/debugger/addToWatch.png diff --git a/platform/icons/src/debugger/autoVariablesMode.png b/platform/icons/src/debugger/autoVariablesMode.png Binary files differindex 1373ec62d488..ba6e1aeade96 100644 --- a/platform/icons/src/debugger/autoVariablesMode.png +++ b/platform/icons/src/debugger/autoVariablesMode.png diff --git a/platform/icons/src/debugger/breakpointAlert.png b/platform/icons/src/debugger/breakpointAlert.png Binary files differindex 02a53dedeb5a..6f1e6b985dee 100644 --- a/platform/icons/src/debugger/breakpointAlert.png +++ b/platform/icons/src/debugger/breakpointAlert.png diff --git a/platform/icons/src/debugger/class_filter.png b/platform/icons/src/debugger/class_filter.png Binary files differindex 1da584cf6b5b..edaeffa3c2c6 100644 --- a/platform/icons/src/debugger/class_filter.png +++ b/platform/icons/src/debugger/class_filter.png diff --git a/platform/icons/src/debugger/console.png b/platform/icons/src/debugger/console.png Binary files differindex 802e281af25a..e2fb628f272a 100644 --- a/platform/icons/src/debugger/console.png +++ b/platform/icons/src/debugger/console.png diff --git a/platform/icons/src/debugger/db_array.png b/platform/icons/src/debugger/db_array.png Binary files differindex eeb3bd84cc3e..29fcab092eca 100644 --- a/platform/icons/src/debugger/db_array.png +++ b/platform/icons/src/debugger/db_array.png diff --git a/platform/icons/src/debugger/db_db_object.png b/platform/icons/src/debugger/db_db_object.png Binary files differindex 04ed39089dfb..2dae90f75412 100644 --- a/platform/icons/src/debugger/db_db_object.png +++ b/platform/icons/src/debugger/db_db_object.png diff --git a/platform/icons/src/debugger/db_dep_exception_breakpoint.png b/platform/icons/src/debugger/db_dep_exception_breakpoint.png Binary files differindex e00b9dbd4ba3..eed700113584 100644 --- a/platform/icons/src/debugger/db_dep_exception_breakpoint.png +++ b/platform/icons/src/debugger/db_dep_exception_breakpoint.png diff --git a/platform/icons/src/debugger/db_dep_field_breakpoint.png b/platform/icons/src/debugger/db_dep_field_breakpoint.png Binary files differindex c59cc5d26198..d27bba9495ff 100644 --- a/platform/icons/src/debugger/db_dep_field_breakpoint.png +++ b/platform/icons/src/debugger/db_dep_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_dep_line_breakpoint.png b/platform/icons/src/debugger/db_dep_line_breakpoint.png Binary files differindex fcb862a56f97..05fdc54ecf16 100644 --- a/platform/icons/src/debugger/db_dep_line_breakpoint.png +++ b/platform/icons/src/debugger/db_dep_line_breakpoint.png diff --git a/platform/icons/src/debugger/db_dep_method_breakpoint.png b/platform/icons/src/debugger/db_dep_method_breakpoint.png Binary files differindex a3791378dc29..0ffdc2dd0ff7 100644 --- a/platform/icons/src/debugger/db_dep_method_breakpoint.png +++ b/platform/icons/src/debugger/db_dep_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_disabled_breakpoint.png b/platform/icons/src/debugger/db_disabled_breakpoint.png Binary files differindex 4a07c6144d6b..4b518c7a56c6 100644 --- a/platform/icons/src/debugger/db_disabled_breakpoint.png +++ b/platform/icons/src/debugger/db_disabled_breakpoint.png diff --git a/platform/icons/src/debugger/db_disabled_breakpoint_process.png b/platform/icons/src/debugger/db_disabled_breakpoint_process.png Binary files differindex 3dc829a75a8c..885d4c979ecb 100644 --- a/platform/icons/src/debugger/db_disabled_breakpoint_process.png +++ b/platform/icons/src/debugger/db_disabled_breakpoint_process.png diff --git a/platform/icons/src/debugger/db_disabled_exception_breakpoint.png b/platform/icons/src/debugger/db_disabled_exception_breakpoint.png Binary files differindex 4af9871b418d..3a907cdcc8aa 100644 --- a/platform/icons/src/debugger/db_disabled_exception_breakpoint.png +++ b/platform/icons/src/debugger/db_disabled_exception_breakpoint.png diff --git a/platform/icons/src/debugger/db_disabled_field_breakpoint.png b/platform/icons/src/debugger/db_disabled_field_breakpoint.png Binary files differindex c8a562f2a2db..57dd5402c99b 100644 --- a/platform/icons/src/debugger/db_disabled_field_breakpoint.png +++ b/platform/icons/src/debugger/db_disabled_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_disabled_method_breakpoint.png b/platform/icons/src/debugger/db_disabled_method_breakpoint.png Binary files differindex 746f8120d03e..72320dcda055 100644 --- a/platform/icons/src/debugger/db_disabled_method_breakpoint.png +++ b/platform/icons/src/debugger/db_disabled_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_exception_breakpoint.png b/platform/icons/src/debugger/db_exception_breakpoint.png Binary files differindex e694aa2bbd4a..185f0580c99c 100644 --- a/platform/icons/src/debugger/db_exception_breakpoint.png +++ b/platform/icons/src/debugger/db_exception_breakpoint.png diff --git a/platform/icons/src/debugger/db_field_breakpoint.png b/platform/icons/src/debugger/db_field_breakpoint.png Binary files differindex f6b92b9abc89..03a52cd34fb0 100644 --- a/platform/icons/src/debugger/db_field_breakpoint.png +++ b/platform/icons/src/debugger/db_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_field_warning_breakpoint.png b/platform/icons/src/debugger/db_field_warning_breakpoint.png Binary files differindex 7ae7b914043f..7083169c0f1a 100644 --- a/platform/icons/src/debugger/db_field_warning_breakpoint.png +++ b/platform/icons/src/debugger/db_field_warning_breakpoint.png diff --git a/platform/icons/src/debugger/db_invalid_breakpoint.png b/platform/icons/src/debugger/db_invalid_breakpoint.png Binary files differindex 21476dde916a..1837d23565ca 100644 --- a/platform/icons/src/debugger/db_invalid_breakpoint.png +++ b/platform/icons/src/debugger/db_invalid_breakpoint.png diff --git a/platform/icons/src/debugger/db_invalid_field_breakpoint.png b/platform/icons/src/debugger/db_invalid_field_breakpoint.png Binary files differindex f5fd928d8bda..afc39c715073 100644 --- a/platform/icons/src/debugger/db_invalid_field_breakpoint.png +++ b/platform/icons/src/debugger/db_invalid_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_invalid_method_breakpoint.png b/platform/icons/src/debugger/db_invalid_method_breakpoint.png Binary files differindex f2d34796125e..5c2e23d6351b 100644 --- a/platform/icons/src/debugger/db_invalid_method_breakpoint.png +++ b/platform/icons/src/debugger/db_invalid_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_method_breakpoint.png b/platform/icons/src/debugger/db_method_breakpoint.png Binary files differindex edfe9aec9a63..efff8d193a17 100644 --- a/platform/icons/src/debugger/db_method_breakpoint.png +++ b/platform/icons/src/debugger/db_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_method_warning_breakpoint.png b/platform/icons/src/debugger/db_method_warning_breakpoint.png Binary files differindex b63b7a9ef8f4..f89034436d8a 100644 --- a/platform/icons/src/debugger/db_method_warning_breakpoint.png +++ b/platform/icons/src/debugger/db_method_warning_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_breakpoint.png b/platform/icons/src/debugger/db_muted_breakpoint.png Binary files differindex e10fac955c3f..5d6e3f280ef3 100644 --- a/platform/icons/src/debugger/db_muted_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_dep_exception_breakpoint.png b/platform/icons/src/debugger/db_muted_dep_exception_breakpoint.png Binary files differindex bcac7b72913e..a11bd495e52a 100644 --- a/platform/icons/src/debugger/db_muted_dep_exception_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_dep_exception_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_dep_field_breakpoint.png b/platform/icons/src/debugger/db_muted_dep_field_breakpoint.png Binary files differindex 21dd4d592fad..845c2197ee10 100644 --- a/platform/icons/src/debugger/db_muted_dep_field_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_dep_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_dep_line_breakpoint.png b/platform/icons/src/debugger/db_muted_dep_line_breakpoint.png Binary files differindex c88d9b949eef..c4cfcf3ecd99 100644 --- a/platform/icons/src/debugger/db_muted_dep_line_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_dep_line_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_dep_method_breakpoint.png b/platform/icons/src/debugger/db_muted_dep_method_breakpoint.png Binary files differindex e1a17320e62e..02ec7de3f1b8 100644 --- a/platform/icons/src/debugger/db_muted_dep_method_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_dep_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_disabled_breakpoint.png b/platform/icons/src/debugger/db_muted_disabled_breakpoint.png Binary files differindex 32f06fd5c06b..f4bbf88f1aec 100644 --- a/platform/icons/src/debugger/db_muted_disabled_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_disabled_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_disabled_breakpoint_process.png b/platform/icons/src/debugger/db_muted_disabled_breakpoint_process.png Binary files differindex a40f16956716..b84728f6fb70 100644 --- a/platform/icons/src/debugger/db_muted_disabled_breakpoint_process.png +++ b/platform/icons/src/debugger/db_muted_disabled_breakpoint_process.png diff --git a/platform/icons/src/debugger/db_muted_disabled_exception_breakpoint.png b/platform/icons/src/debugger/db_muted_disabled_exception_breakpoint.png Binary files differindex 4acef9739fc9..326d93f1e713 100644 --- a/platform/icons/src/debugger/db_muted_disabled_exception_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_disabled_exception_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_disabled_field_breakpoint.png b/platform/icons/src/debugger/db_muted_disabled_field_breakpoint.png Binary files differindex 3ffe11bf1c48..eba6d680ec9c 100644 --- a/platform/icons/src/debugger/db_muted_disabled_field_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_disabled_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_disabled_method_breakpoint.png b/platform/icons/src/debugger/db_muted_disabled_method_breakpoint.png Binary files differindex 0d1c66f30f05..c397f7ad8db1 100644 --- a/platform/icons/src/debugger/db_muted_disabled_method_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_disabled_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_exception_breakpoint.png b/platform/icons/src/debugger/db_muted_exception_breakpoint.png Binary files differindex bdbfc4e7d841..815889286710 100644 --- a/platform/icons/src/debugger/db_muted_exception_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_exception_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_field_breakpoint.png b/platform/icons/src/debugger/db_muted_field_breakpoint.png Binary files differindex f6b89f3162ea..e3c283d11ae3 100644 --- a/platform/icons/src/debugger/db_muted_field_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_field_warning_breakpoint.png b/platform/icons/src/debugger/db_muted_field_warning_breakpoint.png Binary files differindex 9f424e96af34..70ad3d5d8b76 100644 --- a/platform/icons/src/debugger/db_muted_field_warning_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_field_warning_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_invalid_breakpoint.png b/platform/icons/src/debugger/db_muted_invalid_breakpoint.png Binary files differindex f3d36e706085..c61c8a2956af 100644 --- a/platform/icons/src/debugger/db_muted_invalid_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_invalid_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_invalid_field_breakpoint.png b/platform/icons/src/debugger/db_muted_invalid_field_breakpoint.png Binary files differindex 7e8a523829c1..bf9fa81fdea4 100644 --- a/platform/icons/src/debugger/db_muted_invalid_field_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_invalid_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_invalid_method_breakpoint.png b/platform/icons/src/debugger/db_muted_invalid_method_breakpoint.png Binary files differindex 90563a156d56..594fb60de574 100644 --- a/platform/icons/src/debugger/db_muted_invalid_method_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_invalid_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_method_breakpoint.png b/platform/icons/src/debugger/db_muted_method_breakpoint.png Binary files differindex 829904407ac4..a2c543c38b17 100644 --- a/platform/icons/src/debugger/db_muted_method_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_method_warning_breakpoint.png b/platform/icons/src/debugger/db_muted_method_warning_breakpoint.png Binary files differindex fc3e4fa677d1..db19b43e3a62 100644 --- a/platform/icons/src/debugger/db_muted_method_warning_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_method_warning_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_temporary_breakpoint.png b/platform/icons/src/debugger/db_muted_temporary_breakpoint.png Binary files differindex e136cdeae54e..9c08df75fbb6 100644 --- a/platform/icons/src/debugger/db_muted_temporary_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_temporary_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_verified_breakpoint.png b/platform/icons/src/debugger/db_muted_verified_breakpoint.png Binary files differindex 54ef1199632b..2642ddf9000a 100644 --- a/platform/icons/src/debugger/db_muted_verified_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_verified_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_verified_field_breakpoint.png b/platform/icons/src/debugger/db_muted_verified_field_breakpoint.png Binary files differindex 352b59b073d0..9b79e11ea1a6 100644 --- a/platform/icons/src/debugger/db_muted_verified_field_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_verified_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_verified_method_breakpoint.png b/platform/icons/src/debugger/db_muted_verified_method_breakpoint.png Binary files differindex ba737524cfb9..ec37bf8d2c0e 100644 --- a/platform/icons/src/debugger/db_muted_verified_method_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_verified_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_muted_verified_warning_breakpoint.png b/platform/icons/src/debugger/db_muted_verified_warning_breakpoint.png Binary files differindex f85ce19bcbad..1fab1a02b0c0 100644 --- a/platform/icons/src/debugger/db_muted_verified_warning_breakpoint.png +++ b/platform/icons/src/debugger/db_muted_verified_warning_breakpoint.png diff --git a/platform/icons/src/debugger/db_obsolete.png b/platform/icons/src/debugger/db_obsolete.png Binary files differindex 9a8aac049d3a..d17c74152b46 100644 --- a/platform/icons/src/debugger/db_obsolete.png +++ b/platform/icons/src/debugger/db_obsolete.png diff --git a/platform/icons/src/debugger/db_primitive.png b/platform/icons/src/debugger/db_primitive.png Binary files differindex 312c4d2ab523..78da65916d81 100644 --- a/platform/icons/src/debugger/db_primitive.png +++ b/platform/icons/src/debugger/db_primitive.png diff --git a/platform/icons/src/debugger/db_set_breakpoint.png b/platform/icons/src/debugger/db_set_breakpoint.png Binary files differindex cb51c214e853..6335bc27ad84 100644 --- a/platform/icons/src/debugger/db_set_breakpoint.png +++ b/platform/icons/src/debugger/db_set_breakpoint.png diff --git a/platform/icons/src/debugger/db_temporary_breakpoint.png b/platform/icons/src/debugger/db_temporary_breakpoint.png Binary files differindex 2961db38556e..773513a91c2d 100644 --- a/platform/icons/src/debugger/db_temporary_breakpoint.png +++ b/platform/icons/src/debugger/db_temporary_breakpoint.png diff --git a/platform/icons/src/debugger/db_verified_breakpoint.png b/platform/icons/src/debugger/db_verified_breakpoint.png Binary files differindex 79cbb517c888..afd5f9e3b595 100644 --- a/platform/icons/src/debugger/db_verified_breakpoint.png +++ b/platform/icons/src/debugger/db_verified_breakpoint.png diff --git a/platform/icons/src/debugger/db_verified_field_breakpoint.png b/platform/icons/src/debugger/db_verified_field_breakpoint.png Binary files differindex 43dff227993a..63dda6aa353c 100644 --- a/platform/icons/src/debugger/db_verified_field_breakpoint.png +++ b/platform/icons/src/debugger/db_verified_field_breakpoint.png diff --git a/platform/icons/src/debugger/db_verified_method_breakpoint.png b/platform/icons/src/debugger/db_verified_method_breakpoint.png Binary files differindex 8d2c659311c2..6ea75aed391d 100644 --- a/platform/icons/src/debugger/db_verified_method_breakpoint.png +++ b/platform/icons/src/debugger/db_verified_method_breakpoint.png diff --git a/platform/icons/src/debugger/db_verified_warning_breakpoint.png b/platform/icons/src/debugger/db_verified_warning_breakpoint.png Binary files differindex 790672a4cf97..50b2f717a3c5 100644 --- a/platform/icons/src/debugger/db_verified_warning_breakpoint.png +++ b/platform/icons/src/debugger/db_verified_warning_breakpoint.png diff --git a/platform/icons/src/debugger/disable_value_calculation.png b/platform/icons/src/debugger/disable_value_calculation.png Binary files differindex d85eaa029d5f..d9d76f14873c 100644 --- a/platform/icons/src/debugger/disable_value_calculation.png +++ b/platform/icons/src/debugger/disable_value_calculation.png diff --git a/platform/icons/src/debugger/evaluateExpression.png b/platform/icons/src/debugger/evaluateExpression.png Binary files differindex 32e65b690222..3c29fd65856f 100644 --- a/platform/icons/src/debugger/evaluateExpression.png +++ b/platform/icons/src/debugger/evaluateExpression.png diff --git a/platform/icons/src/debugger/frame.png b/platform/icons/src/debugger/frame.png Binary files differindex d5e18ef60e57..a076d302aaf6 100644 --- a/platform/icons/src/debugger/frame.png +++ b/platform/icons/src/debugger/frame.png diff --git a/platform/icons/src/debugger/killProcess.png b/platform/icons/src/debugger/killProcess.png Binary files differindex a2bad8f6419b..71c2aaa89022 100644 --- a/platform/icons/src/debugger/killProcess.png +++ b/platform/icons/src/debugger/killProcess.png diff --git a/platform/icons/src/debugger/muteBreakpoints.png b/platform/icons/src/debugger/muteBreakpoints.png Binary files differindex 40035a638d9e..267598ecd210 100644 --- a/platform/icons/src/debugger/muteBreakpoints.png +++ b/platform/icons/src/debugger/muteBreakpoints.png diff --git a/platform/icons/src/debugger/newWatch.png b/platform/icons/src/debugger/newWatch.png Binary files differindex 61dae5d8f853..bb55684edd43 100644 --- a/platform/icons/src/debugger/newWatch.png +++ b/platform/icons/src/debugger/newWatch.png diff --git a/platform/icons/src/debugger/restoreLayout.png b/platform/icons/src/debugger/restoreLayout.png Binary files differindex be4559406496..c1d6b1ac084b 100644 --- a/platform/icons/src/debugger/restoreLayout.png +++ b/platform/icons/src/debugger/restoreLayout.png diff --git a/platform/icons/src/debugger/showCurrentFrame.png b/platform/icons/src/debugger/showCurrentFrame.png Binary files differindex be54ca72ca80..443997e04614 100644 --- a/platform/icons/src/debugger/showCurrentFrame.png +++ b/platform/icons/src/debugger/showCurrentFrame.png diff --git a/platform/icons/src/debugger/stackFrame.png b/platform/icons/src/debugger/stackFrame.png Binary files differindex fd3daa41a14c..a076d302aaf6 100644 --- a/platform/icons/src/debugger/stackFrame.png +++ b/platform/icons/src/debugger/stackFrame.png diff --git a/platform/icons/src/debugger/threadAtBreakpoint.png b/platform/icons/src/debugger/threadAtBreakpoint.png Binary files differindex ce2ebe6b0f9c..78cfd04743fd 100644 --- a/platform/icons/src/debugger/threadAtBreakpoint.png +++ b/platform/icons/src/debugger/threadAtBreakpoint.png diff --git a/platform/icons/src/debugger/threadCurrent.png b/platform/icons/src/debugger/threadCurrent.png Binary files differindex fc3fcb9ce62a..28f9bf2693be 100644 --- a/platform/icons/src/debugger/threadCurrent.png +++ b/platform/icons/src/debugger/threadCurrent.png diff --git a/platform/icons/src/debugger/threadFrozen.png b/platform/icons/src/debugger/threadFrozen.png Binary files differindex 780426971c3a..93c00d6b4d0a 100644 --- a/platform/icons/src/debugger/threadFrozen.png +++ b/platform/icons/src/debugger/threadFrozen.png diff --git a/platform/icons/src/debugger/threadGroup.png b/platform/icons/src/debugger/threadGroup.png Binary files differindex 3de6f192e24d..892b9509640b 100644 --- a/platform/icons/src/debugger/threadGroup.png +++ b/platform/icons/src/debugger/threadGroup.png diff --git a/platform/icons/src/debugger/threadGroupCurrent.png b/platform/icons/src/debugger/threadGroupCurrent.png Binary files differindex c68bd62d0e5c..81e60cfc6f9c 100644 --- a/platform/icons/src/debugger/threadGroupCurrent.png +++ b/platform/icons/src/debugger/threadGroupCurrent.png diff --git a/platform/icons/src/debugger/threadRunning.png b/platform/icons/src/debugger/threadRunning.png Binary files differindex 775456fc34af..b4816f1d1b16 100644 --- a/platform/icons/src/debugger/threadRunning.png +++ b/platform/icons/src/debugger/threadRunning.png diff --git a/platform/icons/src/debugger/threadStates/daemon_sign.png b/platform/icons/src/debugger/threadStates/daemon_sign.png Binary files differindex a89bd3a2b9de..594a15f5206c 100644 --- a/platform/icons/src/debugger/threadStates/daemon_sign.png +++ b/platform/icons/src/debugger/threadStates/daemon_sign.png diff --git a/platform/icons/src/debugger/threadStates/edtBusy.png b/platform/icons/src/debugger/threadStates/edtBusy.png Binary files differindex 4414cbd28328..075406e50dbe 100644 --- a/platform/icons/src/debugger/threadStates/edtBusy.png +++ b/platform/icons/src/debugger/threadStates/edtBusy.png diff --git a/platform/icons/src/debugger/threadStates/exception.png b/platform/icons/src/debugger/threadStates/exception.png Binary files differindex 2e80bf80d865..816cd62f62d7 100644 --- a/platform/icons/src/debugger/threadStates/exception.png +++ b/platform/icons/src/debugger/threadStates/exception.png diff --git a/platform/icons/src/debugger/threadStates/idle.png b/platform/icons/src/debugger/threadStates/idle.png Binary files differindex b6703024d018..5287bdd69c1f 100644 --- a/platform/icons/src/debugger/threadStates/idle.png +++ b/platform/icons/src/debugger/threadStates/idle.png diff --git a/platform/icons/src/debugger/threadStates/io.png b/platform/icons/src/debugger/threadStates/io.png Binary files differindex e5e1180935d0..40edbf158772 100644 --- a/platform/icons/src/debugger/threadStates/io.png +++ b/platform/icons/src/debugger/threadStates/io.png diff --git a/platform/icons/src/debugger/threadStates/locked.png b/platform/icons/src/debugger/threadStates/locked.png Binary files differindex 7e8c0ebca8bb..9eb5cc43c97d 100644 --- a/platform/icons/src/debugger/threadStates/locked.png +++ b/platform/icons/src/debugger/threadStates/locked.png diff --git a/platform/icons/src/debugger/threadStates/paused.png b/platform/icons/src/debugger/threadStates/paused.png Binary files differindex ecfe1e402b5b..dad15273bf9a 100644 --- a/platform/icons/src/debugger/threadStates/paused.png +++ b/platform/icons/src/debugger/threadStates/paused.png diff --git a/platform/icons/src/debugger/threadStates/running.png b/platform/icons/src/debugger/threadStates/running.png Binary files differindex 049bb8c759fc..9355db4b2de6 100644 --- a/platform/icons/src/debugger/threadStates/running.png +++ b/platform/icons/src/debugger/threadStates/running.png diff --git a/platform/icons/src/debugger/threadStates/socket.png b/platform/icons/src/debugger/threadStates/socket.png Binary files differindex d52f4a650d15..c15a6a0bfc64 100644 --- a/platform/icons/src/debugger/threadStates/socket.png +++ b/platform/icons/src/debugger/threadStates/socket.png diff --git a/platform/icons/src/debugger/threadStates/threaddump.png b/platform/icons/src/debugger/threadStates/threaddump.png Binary files differindex 1ac00fac779c..7ed93a5b8a7c 100644 --- a/platform/icons/src/debugger/threadStates/threaddump.png +++ b/platform/icons/src/debugger/threadStates/threaddump.png diff --git a/platform/icons/src/debugger/threadSuspended.png b/platform/icons/src/debugger/threadSuspended.png Binary files differindex 95754fcee9af..8cf1cc717133 100644 --- a/platform/icons/src/debugger/threadSuspended.png +++ b/platform/icons/src/debugger/threadSuspended.png diff --git a/platform/icons/src/debugger/threads.png b/platform/icons/src/debugger/threads.png Binary files differindex 3215425ed565..ae6d1ce31c08 100644 --- a/platform/icons/src/debugger/threads.png +++ b/platform/icons/src/debugger/threads.png diff --git a/platform/icons/src/debugger/toolConsole.png b/platform/icons/src/debugger/toolConsole.png Binary files differindex f4c201033a40..79b950690e29 100644 --- a/platform/icons/src/debugger/toolConsole.png +++ b/platform/icons/src/debugger/toolConsole.png diff --git a/platform/icons/src/debugger/value.png b/platform/icons/src/debugger/value.png Binary files differindex a104161c3db6..3b6ccb83a420 100644 --- a/platform/icons/src/debugger/value.png +++ b/platform/icons/src/debugger/value.png diff --git a/platform/icons/src/debugger/viewBreakpoints.png b/platform/icons/src/debugger/viewBreakpoints.png Binary files differindex c5aa77724b0b..57537c52d1e1 100644 --- a/platform/icons/src/debugger/viewBreakpoints.png +++ b/platform/icons/src/debugger/viewBreakpoints.png diff --git a/platform/icons/src/debugger/watch.png b/platform/icons/src/debugger/watch.png Binary files differindex 32330c5b189b..27cdbcb6c2d0 100644 --- a/platform/icons/src/debugger/watch.png +++ b/platform/icons/src/debugger/watch.png diff --git a/platform/icons/src/debugger/watchLastReturnValue.png b/platform/icons/src/debugger/watchLastReturnValue.png Binary files differindex 47e19e36beee..8b26ff7f7e8d 100644 --- a/platform/icons/src/debugger/watchLastReturnValue.png +++ b/platform/icons/src/debugger/watchLastReturnValue.png diff --git a/platform/icons/src/debugger/watches.png b/platform/icons/src/debugger/watches.png Binary files differindex 8d68010d6f9a..fb6a961cc79c 100644 --- a/platform/icons/src/debugger/watches.png +++ b/platform/icons/src/debugger/watches.png diff --git a/platform/icons/src/diff/Diff.png b/platform/icons/src/diff/Diff.png Binary files differindex d1408103bc5b..a105010a9642 100644 --- a/platform/icons/src/diff/Diff.png +++ b/platform/icons/src/diff/Diff.png diff --git a/platform/icons/src/diff/applyNotConflicts.png b/platform/icons/src/diff/applyNotConflicts.png Binary files differindex 72060a9e5741..ea3923e5b478 100644 --- a/platform/icons/src/diff/applyNotConflicts.png +++ b/platform/icons/src/diff/applyNotConflicts.png diff --git a/platform/icons/src/diff/arrow.png b/platform/icons/src/diff/arrow.png Binary files differindex c845b70771af..8ef96d805cad 100644 --- a/platform/icons/src/diff/arrow.png +++ b/platform/icons/src/diff/arrow.png diff --git a/platform/icons/src/diff/branchDiff.png b/platform/icons/src/diff/branchDiff.png Binary files differindex ad7d97a607ae..30b202e1f6b9 100644 --- a/platform/icons/src/diff/branchDiff.png +++ b/platform/icons/src/diff/branchDiff.png diff --git a/platform/icons/src/diff/currentLine.png b/platform/icons/src/diff/currentLine.png Binary files differindex 40959155730a..a135cf86b97a 100644 --- a/platform/icons/src/diff/currentLine.png +++ b/platform/icons/src/diff/currentLine.png diff --git a/platform/icons/src/diff/leftDiff.png b/platform/icons/src/diff/leftDiff.png Binary files differindex 870efb0f1145..f71547f90e3d 100644 --- a/platform/icons/src/diff/leftDiff.png +++ b/platform/icons/src/diff/leftDiff.png diff --git a/platform/icons/src/diff/remove.png b/platform/icons/src/diff/remove.png Binary files differindex 60f4247585d9..8bad73e26ae2 100644 --- a/platform/icons/src/diff/remove.png +++ b/platform/icons/src/diff/remove.png diff --git a/platform/icons/src/diff/rightDiff.png b/platform/icons/src/diff/rightDiff.png Binary files differindex e2745cbdc394..55a0377928ae 100644 --- a/platform/icons/src/diff/rightDiff.png +++ b/platform/icons/src/diff/rightDiff.png diff --git a/platform/icons/src/duplicates/sendToTheLeft.png b/platform/icons/src/duplicates/sendToTheLeft.png Binary files differindex 69a287b46078..76645f55a22c 100644 --- a/platform/icons/src/duplicates/sendToTheLeft.png +++ b/platform/icons/src/duplicates/sendToTheLeft.png diff --git a/platform/icons/src/duplicates/sendToTheLeftGrayed.png b/platform/icons/src/duplicates/sendToTheLeftGrayed.png Binary files differindex 41422631c913..ab8565737c5d 100644 --- a/platform/icons/src/duplicates/sendToTheLeftGrayed.png +++ b/platform/icons/src/duplicates/sendToTheLeftGrayed.png diff --git a/platform/icons/src/duplicates/sendToTheRight.png b/platform/icons/src/duplicates/sendToTheRight.png Binary files differindex 1058194d1188..645920405283 100644 --- a/platform/icons/src/duplicates/sendToTheRight.png +++ b/platform/icons/src/duplicates/sendToTheRight.png diff --git a/platform/icons/src/duplicates/sendToTheRightGrayed.png b/platform/icons/src/duplicates/sendToTheRightGrayed.png Binary files differindex 276a53e6ebe8..320c35c78960 100644 --- a/platform/icons/src/duplicates/sendToTheRightGrayed.png +++ b/platform/icons/src/duplicates/sendToTheRightGrayed.png diff --git a/platform/icons/src/fileTypes/any_type.png b/platform/icons/src/fileTypes/any_type.png Binary files differindex a9773c50de40..02b958974c57 100644 --- a/platform/icons/src/fileTypes/any_type.png +++ b/platform/icons/src/fileTypes/any_type.png diff --git a/platform/icons/src/fileTypes/archive.png b/platform/icons/src/fileTypes/archive.png Binary files differindex 433c8d9d18df..79baf02db126 100644 --- a/platform/icons/src/fileTypes/archive.png +++ b/platform/icons/src/fileTypes/archive.png diff --git a/platform/icons/src/fileTypes/as.png b/platform/icons/src/fileTypes/as.png Binary files differindex 8a7fb92769dc..55a8e06a9754 100644 --- a/platform/icons/src/fileTypes/as.png +++ b/platform/icons/src/fileTypes/as.png diff --git a/platform/icons/src/fileTypes/aspectj.png b/platform/icons/src/fileTypes/aspectj.png Binary files differindex b15bcc7efda8..35c17dd9435e 100644 --- a/platform/icons/src/fileTypes/aspectj.png +++ b/platform/icons/src/fileTypes/aspectj.png diff --git a/platform/icons/src/fileTypes/config.png b/platform/icons/src/fileTypes/config.png Binary files differindex 900dee219ed1..e423144c408c 100644 --- a/platform/icons/src/fileTypes/config.png +++ b/platform/icons/src/fileTypes/config.png diff --git a/platform/icons/src/fileTypes/css.png b/platform/icons/src/fileTypes/css.png Binary files differindex 6f018c768828..70b76b22ed32 100644 --- a/platform/icons/src/fileTypes/css.png +++ b/platform/icons/src/fileTypes/css.png diff --git a/platform/icons/src/fileTypes/custom.png b/platform/icons/src/fileTypes/custom.png Binary files differindex 3253676b3d2a..cccc9e83cb91 100644 --- a/platform/icons/src/fileTypes/custom.png +++ b/platform/icons/src/fileTypes/custom.png diff --git a/platform/icons/src/fileTypes/diagram.png b/platform/icons/src/fileTypes/diagram.png Binary files differindex 7efe7cb8b003..236363a94ffa 100644 --- a/platform/icons/src/fileTypes/diagram.png +++ b/platform/icons/src/fileTypes/diagram.png diff --git a/platform/icons/src/fileTypes/dtd.png b/platform/icons/src/fileTypes/dtd.png Binary files differindex bbc3a418a822..41aaa0f73970 100644 --- a/platform/icons/src/fileTypes/dtd.png +++ b/platform/icons/src/fileTypes/dtd.png diff --git a/platform/icons/src/fileTypes/facelets.png b/platform/icons/src/fileTypes/facelets.png Binary files differindex 57210753fdde..e2ca7ae10ff0 100644 --- a/platform/icons/src/fileTypes/facelets.png +++ b/platform/icons/src/fileTypes/facelets.png diff --git a/platform/icons/src/fileTypes/facesConfig.png b/platform/icons/src/fileTypes/facesConfig.png Binary files differindex cd8ad8cae8ac..5083e175e788 100644 --- a/platform/icons/src/fileTypes/facesConfig.png +++ b/platform/icons/src/fileTypes/facesConfig.png diff --git a/platform/icons/src/fileTypes/htaccess.png b/platform/icons/src/fileTypes/htaccess.png Binary files differindex 72888ca10ef9..d66f2653f0a7 100644 --- a/platform/icons/src/fileTypes/htaccess.png +++ b/platform/icons/src/fileTypes/htaccess.png diff --git a/platform/icons/src/fileTypes/html.png b/platform/icons/src/fileTypes/html.png Binary files differindex 61ed4a696ed1..e0afbe5beb6f 100644 --- a/platform/icons/src/fileTypes/html.png +++ b/platform/icons/src/fileTypes/html.png diff --git a/platform/icons/src/fileTypes/idl.png b/platform/icons/src/fileTypes/idl.png Binary files differindex 94d8dad103fb..02306d4cb341 100644 --- a/platform/icons/src/fileTypes/idl.png +++ b/platform/icons/src/fileTypes/idl.png diff --git a/platform/icons/src/fileTypes/java.png b/platform/icons/src/fileTypes/java.png Binary files differindex f459ad462734..ddb3b8eb4c22 100644 --- a/platform/icons/src/fileTypes/java.png +++ b/platform/icons/src/fileTypes/java.png diff --git a/platform/icons/src/fileTypes/javaClass.png b/platform/icons/src/fileTypes/javaClass.png Binary files differindex 72df1a007ccc..58ef27bb26bf 100644 --- a/platform/icons/src/fileTypes/javaClass.png +++ b/platform/icons/src/fileTypes/javaClass.png diff --git a/platform/icons/src/fileTypes/javaOutsideSource.png b/platform/icons/src/fileTypes/javaOutsideSource.png Binary files differindex 267d1b8d5723..168732b77306 100644 --- a/platform/icons/src/fileTypes/javaOutsideSource.png +++ b/platform/icons/src/fileTypes/javaOutsideSource.png diff --git a/platform/icons/src/fileTypes/javaScript.png b/platform/icons/src/fileTypes/javaScript.png Binary files differindex 09d6a9264b0e..7c863d158e09 100644 --- a/platform/icons/src/fileTypes/javaScript.png +++ b/platform/icons/src/fileTypes/javaScript.png diff --git a/platform/icons/src/fileTypes/json.png b/platform/icons/src/fileTypes/json.png Binary files differindex 5b1e2ea685d6..a0cbb1b109b5 100644 --- a/platform/icons/src/fileTypes/json.png +++ b/platform/icons/src/fileTypes/json.png diff --git a/platform/icons/src/fileTypes/jsp.png b/platform/icons/src/fileTypes/jsp.png Binary files differindex 98959dc314bc..2bae0013c4ed 100644 --- a/platform/icons/src/fileTypes/jsp.png +++ b/platform/icons/src/fileTypes/jsp.png diff --git a/platform/icons/src/fileTypes/jspx.png b/platform/icons/src/fileTypes/jspx.png Binary files differindex 50ec850804a8..edad4125c042 100644 --- a/platform/icons/src/fileTypes/jspx.png +++ b/platform/icons/src/fileTypes/jspx.png diff --git a/platform/icons/src/fileTypes/manifest.png b/platform/icons/src/fileTypes/manifest.png Binary files differindex df581b32a401..acf5227558c7 100644 --- a/platform/icons/src/fileTypes/manifest.png +++ b/platform/icons/src/fileTypes/manifest.png diff --git a/platform/icons/src/fileTypes/properties.png b/platform/icons/src/fileTypes/properties.png Binary files differindex 7a4870f6ac1f..bb8ebd60919a 100644 --- a/platform/icons/src/fileTypes/properties.png +++ b/platform/icons/src/fileTypes/properties.png diff --git a/platform/icons/src/fileTypes/text.png b/platform/icons/src/fileTypes/text.png Binary files differindex b7dbcfa9fecd..17988437e520 100644 --- a/platform/icons/src/fileTypes/text.png +++ b/platform/icons/src/fileTypes/text.png diff --git a/platform/icons/src/fileTypes/typeScript.png b/platform/icons/src/fileTypes/typeScript.png Binary files differindex 8e452804b4dd..372bb5973458 100644 --- a/platform/icons/src/fileTypes/typeScript.png +++ b/platform/icons/src/fileTypes/typeScript.png diff --git a/platform/icons/src/fileTypes/uiForm.png b/platform/icons/src/fileTypes/uiForm.png Binary files differindex afa969c7724f..d08772349828 100644 --- a/platform/icons/src/fileTypes/uiForm.png +++ b/platform/icons/src/fileTypes/uiForm.png diff --git a/platform/icons/src/fileTypes/unknown.png b/platform/icons/src/fileTypes/unknown.png Binary files differindex f99546d31542..04c30c9facae 100644 --- a/platform/icons/src/fileTypes/unknown.png +++ b/platform/icons/src/fileTypes/unknown.png diff --git a/platform/icons/src/fileTypes/wsdlFile.png b/platform/icons/src/fileTypes/wsdlFile.png Binary files differindex 9e4faa958b65..0df81949be22 100644 --- a/platform/icons/src/fileTypes/wsdlFile.png +++ b/platform/icons/src/fileTypes/wsdlFile.png diff --git a/platform/icons/src/fileTypes/xhtml.png b/platform/icons/src/fileTypes/xhtml.png Binary files differindex 3faa96fe579d..01f78cde41ba 100644 --- a/platform/icons/src/fileTypes/xhtml.png +++ b/platform/icons/src/fileTypes/xhtml.png diff --git a/platform/icons/src/fileTypes/xml.png b/platform/icons/src/fileTypes/xml.png Binary files differindex 07ad96832aca..029065ef4b62 100644 --- a/platform/icons/src/fileTypes/xml.png +++ b/platform/icons/src/fileTypes/xml.png diff --git a/platform/icons/src/fileTypes/xsdFile.png b/platform/icons/src/fileTypes/xsdFile.png Binary files differindex 026a263869ea..b9b0a4e43286 100644 --- a/platform/icons/src/fileTypes/xsdFile.png +++ b/platform/icons/src/fileTypes/xsdFile.png diff --git a/platform/icons/src/frame_background.png b/platform/icons/src/frame_background.png Binary files differindex b3321527c262..fe9817d2d05c 100644 --- a/platform/icons/src/frame_background.png +++ b/platform/icons/src/frame_background.png diff --git a/platform/icons/src/general/Configure.png b/platform/icons/src/general/Configure.png Binary files differindex 05def6550409..a8ea51f357a9 100644 --- a/platform/icons/src/general/Configure.png +++ b/platform/icons/src/general/Configure.png diff --git a/platform/icons/src/general/CreateNewProjectfromExistingFiles.png b/platform/icons/src/general/CreateNewProjectfromExistingFiles.png Binary files differindex c186f2404a8f..8109a5880fe8 100644 --- a/platform/icons/src/general/CreateNewProjectfromExistingFiles.png +++ b/platform/icons/src/general/CreateNewProjectfromExistingFiles.png diff --git a/platform/icons/src/general/TemplateProjectSettings.png b/platform/icons/src/general/TemplateProjectSettings.png Binary files differindex 28decfad03ac..254cb2544d3e 100644 --- a/platform/icons/src/general/TemplateProjectSettings.png +++ b/platform/icons/src/general/TemplateProjectSettings.png diff --git a/platform/icons/src/general/TemplateProjectStructure.png b/platform/icons/src/general/TemplateProjectStructure.png Binary files differindex 61a83863f9bf..06e624616384 100644 --- a/platform/icons/src/general/TemplateProjectStructure.png +++ b/platform/icons/src/general/TemplateProjectStructure.png diff --git a/platform/icons/src/general/add.png b/platform/icons/src/general/add.png Binary files differindex 79b6aff2e222..9494f2d0c72e 100644 --- a/platform/icons/src/general/add.png +++ b/platform/icons/src/general/add.png diff --git a/platform/icons/src/general/addFavoritesList.png b/platform/icons/src/general/addFavoritesList.png Binary files differindex a1ee4047e398..61f6743e467e 100644 --- a/platform/icons/src/general/addFavoritesList.png +++ b/platform/icons/src/general/addFavoritesList.png diff --git a/platform/icons/src/general/addJdk.png b/platform/icons/src/general/addJdk.png Binary files differindex ab674d7cd98d..ff9912d742f8 100644 --- a/platform/icons/src/general/addJdk.png +++ b/platform/icons/src/general/addJdk.png diff --git a/platform/icons/src/general/arrowDown.png b/platform/icons/src/general/arrowDown.png Binary files differindex 098a5ae0edc5..6464d0991b0f 100644 --- a/platform/icons/src/general/arrowDown.png +++ b/platform/icons/src/general/arrowDown.png diff --git a/platform/icons/src/general/autohideOff.png b/platform/icons/src/general/autohideOff.png Binary files differindex 7ec50e54c70f..681d3171f963 100644 --- a/platform/icons/src/general/autohideOff.png +++ b/platform/icons/src/general/autohideOff.png diff --git a/platform/icons/src/general/autohideOffInactive.png b/platform/icons/src/general/autohideOffInactive.png Binary files differindex f60866f8cc49..c6ae3c5875d4 100644 --- a/platform/icons/src/general/autohideOffInactive.png +++ b/platform/icons/src/general/autohideOffInactive.png diff --git a/platform/icons/src/general/autoscrollFromSource.png b/platform/icons/src/general/autoscrollFromSource.png Binary files differindex 8771a429654b..25debef777e3 100644 --- a/platform/icons/src/general/autoscrollFromSource.png +++ b/platform/icons/src/general/autoscrollFromSource.png diff --git a/platform/icons/src/general/autoscrollToSource.png b/platform/icons/src/general/autoscrollToSource.png Binary files differindex 6a91ff5ff0d5..57e29c333c1d 100644 --- a/platform/icons/src/general/autoscrollToSource.png +++ b/platform/icons/src/general/autoscrollToSource.png diff --git a/platform/icons/src/general/balloon.png b/platform/icons/src/general/balloon.png Binary files differindex b50186baa50a..2b1eeaaf8d30 100644 --- a/platform/icons/src/general/balloon.png +++ b/platform/icons/src/general/balloon.png diff --git a/platform/icons/src/general/balloonClose.png b/platform/icons/src/general/balloonClose.png Binary files differindex aa4edd0ae465..1baba81175b8 100644 --- a/platform/icons/src/general/balloonClose.png +++ b/platform/icons/src/general/balloonClose.png diff --git a/platform/icons/src/general/balloonError.png b/platform/icons/src/general/balloonError.png Binary files differindex 66558b4e98ce..bdca36e2deb9 100644 --- a/platform/icons/src/general/balloonError.png +++ b/platform/icons/src/general/balloonError.png diff --git a/platform/icons/src/general/balloonInformation.png b/platform/icons/src/general/balloonInformation.png Binary files differindex 1bcaf4a5d6e5..0966ec99420d 100644 --- a/platform/icons/src/general/balloonInformation.png +++ b/platform/icons/src/general/balloonInformation.png diff --git a/platform/icons/src/general/balloonWarning.png b/platform/icons/src/general/balloonWarning.png Binary files differindex 9f5a8629920c..87d9e277df16 100644 --- a/platform/icons/src/general/balloonWarning.png +++ b/platform/icons/src/general/balloonWarning.png diff --git a/platform/icons/src/general/bullet.png b/platform/icons/src/general/bullet.png Binary files differindex a9fa94db9b12..4b9c50a2946b 100644 --- a/platform/icons/src/general/bullet.png +++ b/platform/icons/src/general/bullet.png diff --git a/platform/icons/src/general/collapseAll.png b/platform/icons/src/general/collapseAll.png Binary files differindex dd00a4296bd7..7c517500a18e 100644 --- a/platform/icons/src/general/collapseAll.png +++ b/platform/icons/src/general/collapseAll.png diff --git a/platform/icons/src/general/collapseAllHover.png b/platform/icons/src/general/collapseAllHover.png Binary files differindex faf3fc763519..53d1553d7647 100755 --- a/platform/icons/src/general/collapseAllHover.png +++ b/platform/icons/src/general/collapseAllHover.png diff --git a/platform/icons/src/general/combo.png b/platform/icons/src/general/combo.png Binary files differindex 5a546632b4fb..b90b64087e1c 100644 --- a/platform/icons/src/general/combo.png +++ b/platform/icons/src/general/combo.png diff --git a/platform/icons/src/general/combo2.png b/platform/icons/src/general/combo2.png Binary files differindex edabd1cad1ee..30f70dd51695 100644 --- a/platform/icons/src/general/combo2.png +++ b/platform/icons/src/general/combo2.png diff --git a/platform/icons/src/general/comboArrow.png b/platform/icons/src/general/comboArrow.png Binary files differindex 363bd7b78481..f17fa83f6746 100644 --- a/platform/icons/src/general/comboArrow.png +++ b/platform/icons/src/general/comboArrow.png diff --git a/platform/icons/src/general/comboArrowDown.png b/platform/icons/src/general/comboArrowDown.png Binary files differindex 3a1656e8732f..3202ce034aa7 100644 --- a/platform/icons/src/general/comboArrowDown.png +++ b/platform/icons/src/general/comboArrowDown.png diff --git a/platform/icons/src/general/comboArrowLeft.png b/platform/icons/src/general/comboArrowLeft.png Binary files differindex ffaa0cb95ceb..598327963286 100644 --- a/platform/icons/src/general/comboArrowLeft.png +++ b/platform/icons/src/general/comboArrowLeft.png diff --git a/platform/icons/src/general/comboArrowLeftPassive.png b/platform/icons/src/general/comboArrowLeftPassive.png Binary files differindex 57c2219afcaa..b6cf2dfc3b4e 100644 --- a/platform/icons/src/general/comboArrowLeftPassive.png +++ b/platform/icons/src/general/comboArrowLeftPassive.png diff --git a/platform/icons/src/general/comboArrowRight.png b/platform/icons/src/general/comboArrowRight.png Binary files differindex 0fc599731620..af18a7a3c6ba 100644 --- a/platform/icons/src/general/comboArrowRight.png +++ b/platform/icons/src/general/comboArrowRight.png diff --git a/platform/icons/src/general/comboArrowRightPassive.png b/platform/icons/src/general/comboArrowRightPassive.png Binary files differindex c6e75331ccba..d46b8ff60a2a 100644 --- a/platform/icons/src/general/comboArrowRightPassive.png +++ b/platform/icons/src/general/comboArrowRightPassive.png diff --git a/platform/icons/src/general/comboBoxButtonArrow.png b/platform/icons/src/general/comboBoxButtonArrow.png Binary files differindex aa7de5dd6da2..0963dd7e2f3d 100644 --- a/platform/icons/src/general/comboBoxButtonArrow.png +++ b/platform/icons/src/general/comboBoxButtonArrow.png diff --git a/platform/icons/src/general/comboUpPassive.png b/platform/icons/src/general/comboUpPassive.png Binary files differindex 6b02e6e99f54..cbd813effa92 100644 --- a/platform/icons/src/general/comboUpPassive.png +++ b/platform/icons/src/general/comboUpPassive.png diff --git a/platform/icons/src/general/createNewProject.png b/platform/icons/src/general/createNewProject.png Binary files differindex 92adf28428d3..ed9f5ac4bb04 100644 --- a/platform/icons/src/general/createNewProject.png +++ b/platform/icons/src/general/createNewProject.png diff --git a/platform/icons/src/general/debug.png b/platform/icons/src/general/debug.png Binary files differindex c3f4cfb60a94..f8c6e95e08d2 100644 --- a/platform/icons/src/general/debug.png +++ b/platform/icons/src/general/debug.png diff --git a/platform/icons/src/general/defaultKeymap.png b/platform/icons/src/general/defaultKeymap.png Binary files differindex cb6b141f71e5..e99cd0b421f7 100644 --- a/platform/icons/src/general/defaultKeymap.png +++ b/platform/icons/src/general/defaultKeymap.png diff --git a/platform/icons/src/general/downloadPlugin.png b/platform/icons/src/general/downloadPlugin.png Binary files differindex 7dde20a414b2..deb21e1c2ae7 100644 --- a/platform/icons/src/general/downloadPlugin.png +++ b/platform/icons/src/general/downloadPlugin.png diff --git a/platform/icons/src/general/dropdown.png b/platform/icons/src/general/dropdown.png Binary files differindex ee760b5713fb..a52c209d1672 100644 --- a/platform/icons/src/general/dropdown.png +++ b/platform/icons/src/general/dropdown.png diff --git a/platform/icons/src/general/editColors.png b/platform/icons/src/general/editColors.png Binary files differindex 6011e2c3d01e..365608d72038 100644 --- a/platform/icons/src/general/editColors.png +++ b/platform/icons/src/general/editColors.png diff --git a/platform/icons/src/general/error.png b/platform/icons/src/general/error.png Binary files differindex bab318774f96..528cf42b8ec3 100644 --- a/platform/icons/src/general/error.png +++ b/platform/icons/src/general/error.png diff --git a/platform/icons/src/general/errorDialog.png b/platform/icons/src/general/errorDialog.png Binary files differindex 1283db6d1195..d4b8d2bdb681 100644 --- a/platform/icons/src/general/errorDialog.png +++ b/platform/icons/src/general/errorDialog.png diff --git a/platform/icons/src/general/errorMask.png b/platform/icons/src/general/errorMask.png Binary files differindex fcd310abf417..c9e0305c1b3c 100644 --- a/platform/icons/src/general/errorMask.png +++ b/platform/icons/src/general/errorMask.png diff --git a/platform/icons/src/general/exclMark.png b/platform/icons/src/general/exclMark.png Binary files differindex a4fab81f2c56..8b80034f451c 100644 --- a/platform/icons/src/general/exclMark.png +++ b/platform/icons/src/general/exclMark.png diff --git a/platform/icons/src/general/expandAll.png b/platform/icons/src/general/expandAll.png Binary files differindex 2ddebd539692..0129871e0efc 100644 --- a/platform/icons/src/general/expandAll.png +++ b/platform/icons/src/general/expandAll.png diff --git a/platform/icons/src/general/expandAllHover.png b/platform/icons/src/general/expandAllHover.png Binary files differindex 1becda0e2fd6..7ef36e68a4a8 100644 --- a/platform/icons/src/general/expandAllHover.png +++ b/platform/icons/src/general/expandAllHover.png diff --git a/platform/icons/src/general/externalTools.png b/platform/icons/src/general/externalTools.png Binary files differindex ba4085dfa0fd..579be6b04962 100644 --- a/platform/icons/src/general/externalTools.png +++ b/platform/icons/src/general/externalTools.png diff --git a/platform/icons/src/general/externalToolsSmall.png b/platform/icons/src/general/externalToolsSmall.png Binary files differindex 0d55a24e139e..a9fea0d05bc1 100644 --- a/platform/icons/src/general/externalToolsSmall.png +++ b/platform/icons/src/general/externalToolsSmall.png diff --git a/platform/icons/src/general/filter.png b/platform/icons/src/general/filter.png Binary files differindex 1da584cf6b5b..edaeffa3c2c6 100644 --- a/platform/icons/src/general/filter.png +++ b/platform/icons/src/general/filter.png diff --git a/platform/icons/src/general/floating.png b/platform/icons/src/general/floating.png Binary files differindex 5ee3f199997e..a4c3f06d3279 100644 --- a/platform/icons/src/general/floating.png +++ b/platform/icons/src/general/floating.png diff --git a/platform/icons/src/general/gear.png b/platform/icons/src/general/gear.png Binary files differindex ef4a0dfb0444..bbbd072af463 100644 --- a/platform/icons/src/general/gear.png +++ b/platform/icons/src/general/gear.png diff --git a/platform/icons/src/general/gearHover.png b/platform/icons/src/general/gearHover.png Binary files differindex 2609672b4343..e5a79f942f41 100755 --- a/platform/icons/src/general/gearHover.png +++ b/platform/icons/src/general/gearHover.png diff --git a/platform/icons/src/general/getProjectfromVCS.png b/platform/icons/src/general/getProjectfromVCS.png Binary files differindex dd9457449ef8..5e46d1e8c171 100644 --- a/platform/icons/src/general/getProjectfromVCS.png +++ b/platform/icons/src/general/getProjectfromVCS.png diff --git a/platform/icons/src/general/help_small.png b/platform/icons/src/general/help_small.png Binary files differindex 5f418a165e80..7ef94d3702df 100644 --- a/platform/icons/src/general/help_small.png +++ b/platform/icons/src/general/help_small.png diff --git a/platform/icons/src/general/hideDown.png b/platform/icons/src/general/hideDown.png Binary files differindex a6c8eacd1b88..1c4ba86afaf0 100644 --- a/platform/icons/src/general/hideDown.png +++ b/platform/icons/src/general/hideDown.png diff --git a/platform/icons/src/general/hideDownHover.png b/platform/icons/src/general/hideDownHover.png Binary files differindex 2aa8a1a16879..5c5bc349b76e 100755 --- a/platform/icons/src/general/hideDownHover.png +++ b/platform/icons/src/general/hideDownHover.png diff --git a/platform/icons/src/general/hideDownPart.png b/platform/icons/src/general/hideDownPart.png Binary files differindex 4fb2b55c4dab..58ab0cbfc39c 100644 --- a/platform/icons/src/general/hideDownPart.png +++ b/platform/icons/src/general/hideDownPart.png diff --git a/platform/icons/src/general/hideDownPartHover.png b/platform/icons/src/general/hideDownPartHover.png Binary files differindex 1b7069110019..e56181100a42 100755 --- a/platform/icons/src/general/hideDownPartHover.png +++ b/platform/icons/src/general/hideDownPartHover.png diff --git a/platform/icons/src/general/hideLeft.png b/platform/icons/src/general/hideLeft.png Binary files differindex 35cd1cbf62a8..eb30680697ca 100644 --- a/platform/icons/src/general/hideLeft.png +++ b/platform/icons/src/general/hideLeft.png diff --git a/platform/icons/src/general/hideLeftHover.png b/platform/icons/src/general/hideLeftHover.png Binary files differindex be59841c7b94..0974acaccb3e 100755 --- a/platform/icons/src/general/hideLeftHover.png +++ b/platform/icons/src/general/hideLeftHover.png diff --git a/platform/icons/src/general/hideLeftPart.png b/platform/icons/src/general/hideLeftPart.png Binary files differindex 1f94f2e85f3e..d7360ef3be5a 100644 --- a/platform/icons/src/general/hideLeftPart.png +++ b/platform/icons/src/general/hideLeftPart.png diff --git a/platform/icons/src/general/hideLeftPartHover.png b/platform/icons/src/general/hideLeftPartHover.png Binary files differindex 356c16e6d957..a54d4905e149 100755 --- a/platform/icons/src/general/hideLeftPartHover.png +++ b/platform/icons/src/general/hideLeftPartHover.png diff --git a/platform/icons/src/general/hideRight.png b/platform/icons/src/general/hideRight.png Binary files differindex cb36772d0c14..3392caa4e6ce 100644 --- a/platform/icons/src/general/hideRight.png +++ b/platform/icons/src/general/hideRight.png diff --git a/platform/icons/src/general/hideRightHover.png b/platform/icons/src/general/hideRightHover.png Binary files differindex 3bfd31593ab2..ffb593aa8101 100755 --- a/platform/icons/src/general/hideRightHover.png +++ b/platform/icons/src/general/hideRightHover.png diff --git a/platform/icons/src/general/hideRightPart.png b/platform/icons/src/general/hideRightPart.png Binary files differindex 339e56eb2aef..3381faec56a4 100644 --- a/platform/icons/src/general/hideRightPart.png +++ b/platform/icons/src/general/hideRightPart.png diff --git a/platform/icons/src/general/hideRightPartHover.png b/platform/icons/src/general/hideRightPartHover.png Binary files differindex f05952ae54e8..c8f3715f34e5 100755 --- a/platform/icons/src/general/hideRightPartHover.png +++ b/platform/icons/src/general/hideRightPartHover.png diff --git a/platform/icons/src/general/hideToolWindow.png b/platform/icons/src/general/hideToolWindow.png Binary files differindex ff6e90725ef7..94518d0c063e 100644 --- a/platform/icons/src/general/hideToolWindow.png +++ b/platform/icons/src/general/hideToolWindow.png diff --git a/platform/icons/src/general/hideToolWindowInactive.png b/platform/icons/src/general/hideToolWindowInactive.png Binary files differindex db63eec9c2cf..aa30473133a7 100644 --- a/platform/icons/src/general/hideToolWindowInactive.png +++ b/platform/icons/src/general/hideToolWindowInactive.png diff --git a/platform/icons/src/general/hideWarnings.png b/platform/icons/src/general/hideWarnings.png Binary files differindex 7a41e37651f7..8479a7a3b7d1 100644 --- a/platform/icons/src/general/hideWarnings.png +++ b/platform/icons/src/general/hideWarnings.png diff --git a/platform/icons/src/general/ijLogo.png b/platform/icons/src/general/ijLogo.png Binary files differindex e5bb5046d10c..3353c7955590 100644 --- a/platform/icons/src/general/ijLogo.png +++ b/platform/icons/src/general/ijLogo.png diff --git a/platform/icons/src/general/importProject.png b/platform/icons/src/general/importProject.png Binary files differindex 4e8145f8e665..e51095050bf8 100644 --- a/platform/icons/src/general/importProject.png +++ b/platform/icons/src/general/importProject.png diff --git a/platform/icons/src/general/information.png b/platform/icons/src/general/information.png Binary files differindex 4d3783491c28..87adef9f93c4 100644 --- a/platform/icons/src/general/information.png +++ b/platform/icons/src/general/information.png diff --git a/platform/icons/src/general/informationDialog.png b/platform/icons/src/general/informationDialog.png Binary files differindex bbbf65ef966c..dcc83c11fcc9 100644 --- a/platform/icons/src/general/informationDialog.png +++ b/platform/icons/src/general/informationDialog.png diff --git a/platform/icons/src/general/inspectionInProgress.png b/platform/icons/src/general/inspectionInProgress.png Binary files differindex 34d4875e14d4..9d979989df36 100644 --- a/platform/icons/src/general/inspectionInProgress.png +++ b/platform/icons/src/general/inspectionInProgress.png diff --git a/platform/icons/src/general/jdk.png b/platform/icons/src/general/jdk.png Binary files differindex 92d94c6e4636..d2edbfe99037 100644 --- a/platform/icons/src/general/jdk.png +++ b/platform/icons/src/general/jdk.png diff --git a/platform/icons/src/general/jetbrainsTvIdea.png b/platform/icons/src/general/jetbrainsTvIdea.png Binary files differindex 43c0d06a6ea0..da3ae085bede 100644 --- a/platform/icons/src/general/jetbrainsTvIdea.png +++ b/platform/icons/src/general/jetbrainsTvIdea.png diff --git a/platform/icons/src/general/keymap.png b/platform/icons/src/general/keymap.png Binary files differindex e84b1ab80273..020e748845db 100644 --- a/platform/icons/src/general/keymap.png +++ b/platform/icons/src/general/keymap.png diff --git a/platform/icons/src/general/locate.png b/platform/icons/src/general/locate.png Binary files differindex 373581f02dfd..09250c7c4857 100644 --- a/platform/icons/src/general/locate.png +++ b/platform/icons/src/general/locate.png diff --git a/platform/icons/src/general/locateHover.png b/platform/icons/src/general/locateHover.png Binary files differindex 7a9b8688460f..b354dfbe72bf 100755 --- a/platform/icons/src/general/locateHover.png +++ b/platform/icons/src/general/locateHover.png diff --git a/platform/icons/src/general/macCorner.png b/platform/icons/src/general/macCorner.png Binary files differindex 28bdb7b90d3b..9226f36867e5 100644 --- a/platform/icons/src/general/macCorner.png +++ b/platform/icons/src/general/macCorner.png diff --git a/platform/icons/src/general/mdot.png b/platform/icons/src/general/mdot.png Binary files differindex 91540aa1cb57..d9b3a18bd232 100644 --- a/platform/icons/src/general/mdot.png +++ b/platform/icons/src/general/mdot.png diff --git a/platform/icons/src/general/messageHistory.png b/platform/icons/src/general/messageHistory.png Binary files differindex 28ca74c6bbc5..57cc96bc80e4 100644 --- a/platform/icons/src/general/messageHistory.png +++ b/platform/icons/src/general/messageHistory.png diff --git a/platform/icons/src/general/mouse.png b/platform/icons/src/general/mouse.png Binary files differindex 4a07a796641f..d22066dc9d44 100644 --- a/platform/icons/src/general/mouse.png +++ b/platform/icons/src/general/mouse.png diff --git a/platform/icons/src/general/noAnalysis.png b/platform/icons/src/general/noAnalysis.png Binary files differindex 0c45822a6ae7..b7a501a4261c 100644 --- a/platform/icons/src/general/noAnalysis.png +++ b/platform/icons/src/general/noAnalysis.png diff --git a/platform/icons/src/general/packagesTab.png b/platform/icons/src/general/packagesTab.png Binary files differindex ee44985fa5f8..554c5ef03a9d 100644 --- a/platform/icons/src/general/packagesTab.png +++ b/platform/icons/src/general/packagesTab.png diff --git a/platform/icons/src/general/pathVariables.png b/platform/icons/src/general/pathVariables.png Binary files differindex d255d39266a3..496cd03cbb24 100644 --- a/platform/icons/src/general/pathVariables.png +++ b/platform/icons/src/general/pathVariables.png diff --git a/platform/icons/src/general/pin_tab.png b/platform/icons/src/general/pin_tab.png Binary files differindex c2e1d3a84616..9c0a731f7fe7 100644 --- a/platform/icons/src/general/pin_tab.png +++ b/platform/icons/src/general/pin_tab.png diff --git a/platform/icons/src/general/pluginManager.png b/platform/icons/src/general/pluginManager.png Binary files differindex 4315c418427f..f794e14c4a9d 100644 --- a/platform/icons/src/general/pluginManager.png +++ b/platform/icons/src/general/pluginManager.png diff --git a/platform/icons/src/general/projectSettings.png b/platform/icons/src/general/projectSettings.png Binary files differindex add2aa0a5e96..73dd1a77825b 100644 --- a/platform/icons/src/general/projectSettings.png +++ b/platform/icons/src/general/projectSettings.png diff --git a/platform/icons/src/general/projectStructure.png b/platform/icons/src/general/projectStructure.png Binary files differindex 8a10de21d7de..51349afa7b6d 100644 --- a/platform/icons/src/general/projectStructure.png +++ b/platform/icons/src/general/projectStructure.png diff --git a/platform/icons/src/general/projectTab.png b/platform/icons/src/general/projectTab.png Binary files differindex cba6fb06ee34..af3e32fb1dce 100644 --- a/platform/icons/src/general/projectTab.png +++ b/platform/icons/src/general/projectTab.png diff --git a/platform/icons/src/general/questionDialog.png b/platform/icons/src/general/questionDialog.png Binary files differindex 64f1039fe57d..b0a7de119cc0 100644 --- a/platform/icons/src/general/questionDialog.png +++ b/platform/icons/src/general/questionDialog.png diff --git a/platform/icons/src/general/readHelp.png b/platform/icons/src/general/readHelp.png Binary files differindex 8ffa8e2e0ee4..ebdfc5e49031 100644 --- a/platform/icons/src/general/readHelp.png +++ b/platform/icons/src/general/readHelp.png diff --git a/platform/icons/src/general/remove.png b/platform/icons/src/general/remove.png Binary files differindex 0cec44b54d80..6a0c24ca6771 100644 --- a/platform/icons/src/general/remove.png +++ b/platform/icons/src/general/remove.png diff --git a/platform/icons/src/general/reset.png b/platform/icons/src/general/reset.png Binary files differindex 8a973774e18f..42710012edb7 100644 --- a/platform/icons/src/general/reset.png +++ b/platform/icons/src/general/reset.png diff --git a/platform/icons/src/general/run.png b/platform/icons/src/general/run.png Binary files differindex d18a3170500b..1d27f5390595 100644 --- a/platform/icons/src/general/run.png +++ b/platform/icons/src/general/run.png diff --git a/platform/icons/src/general/runWithCoverage.png b/platform/icons/src/general/runWithCoverage.png Binary files differindex cc427896ffd8..29c10cf4487e 100644 --- a/platform/icons/src/general/runWithCoverage.png +++ b/platform/icons/src/general/runWithCoverage.png diff --git a/platform/icons/src/general/secondaryGroup.png b/platform/icons/src/general/secondaryGroup.png Binary files differindex bfabb5f0e3e2..cfa66aa2ec1d 100644 --- a/platform/icons/src/general/secondaryGroup.png +++ b/platform/icons/src/general/secondaryGroup.png diff --git a/platform/icons/src/general/separatorH.png b/platform/icons/src/general/separatorH.png Binary files differindex eb046a3b453f..bef760bc41c1 100644 --- a/platform/icons/src/general/separatorH.png +++ b/platform/icons/src/general/separatorH.png diff --git a/platform/icons/src/general/settings.png b/platform/icons/src/general/settings.png Binary files differindex 003d6d06b2d9..a9583df177e1 100644 --- a/platform/icons/src/general/settings.png +++ b/platform/icons/src/general/settings.png diff --git a/platform/icons/src/general/show_to_override.png b/platform/icons/src/general/show_to_override.png Binary files differindex 537775bf7776..533b9c2f2df8 100644 --- a/platform/icons/src/general/show_to_override.png +++ b/platform/icons/src/general/show_to_override.png diff --git a/platform/icons/src/general/smallConfigurableVcs.png b/platform/icons/src/general/smallConfigurableVcs.png Binary files differindex ed6dcdee4a65..a09f75342393 100644 --- a/platform/icons/src/general/smallConfigurableVcs.png +++ b/platform/icons/src/general/smallConfigurableVcs.png diff --git a/platform/icons/src/general/splitCenterH.png b/platform/icons/src/general/splitCenterH.png Binary files differindex 2f3166477edf..fc94d9be36ae 100644 --- a/platform/icons/src/general/splitCenterH.png +++ b/platform/icons/src/general/splitCenterH.png diff --git a/platform/icons/src/general/splitCenterV.png b/platform/icons/src/general/splitCenterV.png Binary files differindex 359a2d486644..52eabc5db994 100644 --- a/platform/icons/src/general/splitCenterV.png +++ b/platform/icons/src/general/splitCenterV.png diff --git a/platform/icons/src/general/splitDown.png b/platform/icons/src/general/splitDown.png Binary files differindex e2612ac7715b..6c7dc827a4b9 100644 --- a/platform/icons/src/general/splitDown.png +++ b/platform/icons/src/general/splitDown.png diff --git a/platform/icons/src/general/splitGlueH.png b/platform/icons/src/general/splitGlueH.png Binary files differindex 0d2e8d0a793a..7e0e99d25ee5 100644 --- a/platform/icons/src/general/splitGlueH.png +++ b/platform/icons/src/general/splitGlueH.png diff --git a/platform/icons/src/general/splitGlueV.png b/platform/icons/src/general/splitGlueV.png Binary files differindex 1f465453117e..90413cb48a51 100644 --- a/platform/icons/src/general/splitGlueV.png +++ b/platform/icons/src/general/splitGlueV.png diff --git a/platform/icons/src/general/splitLeft.png b/platform/icons/src/general/splitLeft.png Binary files differindex c2d462033c88..84328a9737c9 100644 --- a/platform/icons/src/general/splitLeft.png +++ b/platform/icons/src/general/splitLeft.png diff --git a/platform/icons/src/general/splitRight.png b/platform/icons/src/general/splitRight.png Binary files differindex cda73d7e952e..25eb1eda0f0f 100644 --- a/platform/icons/src/general/splitRight.png +++ b/platform/icons/src/general/splitRight.png diff --git a/platform/icons/src/general/splitUp.png b/platform/icons/src/general/splitUp.png Binary files differindex 4ab025342328..554a49ea3cc2 100644 --- a/platform/icons/src/general/splitUp.png +++ b/platform/icons/src/general/splitUp.png diff --git a/platform/icons/src/general/tab-white-center.png b/platform/icons/src/general/tab-white-center.png Binary files differindex 358df8a0aa50..dfa003d3d200 100644 --- a/platform/icons/src/general/tab-white-center.png +++ b/platform/icons/src/general/tab-white-center.png diff --git a/platform/icons/src/general/tab-white-right.png b/platform/icons/src/general/tab-white-right.png Binary files differindex 65c1a0baeb8a..9d57a5b71049 100644 --- a/platform/icons/src/general/tab-white-right.png +++ b/platform/icons/src/general/tab-white-right.png diff --git a/platform/icons/src/general/tab_grey_bckgrnd.png b/platform/icons/src/general/tab_grey_bckgrnd.png Binary files differindex bb3a65a921e5..a3435b0b95ee 100644 --- a/platform/icons/src/general/tab_grey_bckgrnd.png +++ b/platform/icons/src/general/tab_grey_bckgrnd.png diff --git a/platform/icons/src/general/tab_grey_left.png b/platform/icons/src/general/tab_grey_left.png Binary files differindex 52bfe77aa363..c8bca74676ed 100644 --- a/platform/icons/src/general/tab_grey_left.png +++ b/platform/icons/src/general/tab_grey_left.png diff --git a/platform/icons/src/general/tab_grey_right.png b/platform/icons/src/general/tab_grey_right.png Binary files differindex 4589fb0f90e7..35956d3fbd25 100644 --- a/platform/icons/src/general/tab_grey_right.png +++ b/platform/icons/src/general/tab_grey_right.png diff --git a/platform/icons/src/general/tab_grey_right_inner.png b/platform/icons/src/general/tab_grey_right_inner.png Binary files differindex 4a64bc323e3d..205252be542b 100644 --- a/platform/icons/src/general/tab_grey_right_inner.png +++ b/platform/icons/src/general/tab_grey_right_inner.png diff --git a/platform/icons/src/general/tbHidden.png b/platform/icons/src/general/tbHidden.png Binary files differindex 7f7d52ffca53..acc6d64e3a65 100644 --- a/platform/icons/src/general/tbHidden.png +++ b/platform/icons/src/general/tbHidden.png diff --git a/platform/icons/src/general/tbShown.png b/platform/icons/src/general/tbShown.png Binary files differindex 367d9bcfe9a5..a9dde8e7c04f 100644 --- a/platform/icons/src/general/tbShown.png +++ b/platform/icons/src/general/tbShown.png diff --git a/platform/icons/src/general/tip.png b/platform/icons/src/general/tip.png Binary files differindex 43c394cdb41d..2b62f2ac9b39 100644 --- a/platform/icons/src/general/tip.png +++ b/platform/icons/src/general/tip.png diff --git a/platform/icons/src/general/tipsOfTheDay.png b/platform/icons/src/general/tipsOfTheDay.png Binary files differindex e47742f7f8e4..8c3c76205336 100644 --- a/platform/icons/src/general/tipsOfTheDay.png +++ b/platform/icons/src/general/tipsOfTheDay.png diff --git a/platform/icons/src/general/uninstallPlugin.png b/platform/icons/src/general/uninstallPlugin.png Binary files differindex 019973d325f8..9c32d4c87851 100644 --- a/platform/icons/src/general/uninstallPlugin.png +++ b/platform/icons/src/general/uninstallPlugin.png diff --git a/platform/icons/src/general/warning.png b/platform/icons/src/general/warning.png Binary files differindex 2290ad73c174..3b455dfdd1e7 100644 --- a/platform/icons/src/general/warning.png +++ b/platform/icons/src/general/warning.png diff --git a/platform/icons/src/general/warningDecorator.png b/platform/icons/src/general/warningDecorator.png Binary files differindex 998938f7ae79..9c42ab40bd70 100644 --- a/platform/icons/src/general/warningDecorator.png +++ b/platform/icons/src/general/warningDecorator.png diff --git a/platform/icons/src/general/warningDialog.png b/platform/icons/src/general/warningDialog.png Binary files differindex 47cb19620560..707f2531b140 100644 --- a/platform/icons/src/general/warningDialog.png +++ b/platform/icons/src/general/warningDialog.png diff --git a/platform/icons/src/general/web.png b/platform/icons/src/general/web.png Binary files differindex 5d5ba74be6a6..0b6b9d16d714 100644 --- a/platform/icons/src/general/web.png +++ b/platform/icons/src/general/web.png diff --git a/platform/icons/src/graph/actualZoom.png b/platform/icons/src/graph/actualZoom.png Binary files differindex 075fbaadbcdc..faf9240b942f 100644 --- a/platform/icons/src/graph/actualZoom.png +++ b/platform/icons/src/graph/actualZoom.png diff --git a/platform/icons/src/graph/export.png b/platform/icons/src/graph/export.png Binary files differindex 01975b7c8134..58138a9fae2b 100644 --- a/platform/icons/src/graph/export.png +++ b/platform/icons/src/graph/export.png diff --git a/platform/icons/src/graph/fitContent.png b/platform/icons/src/graph/fitContent.png Binary files differindex 64b927996931..f10f05068206 100644 --- a/platform/icons/src/graph/fitContent.png +++ b/platform/icons/src/graph/fitContent.png diff --git a/platform/icons/src/graph/grid.png b/platform/icons/src/graph/grid.png Binary files differindex 9102ef0a7290..562f1aa3b93d 100644 --- a/platform/icons/src/graph/grid.png +++ b/platform/icons/src/graph/grid.png diff --git a/platform/icons/src/graph/layout.png b/platform/icons/src/graph/layout.png Binary files differindex 85d1e34cc680..54682ca9ae55 100644 --- a/platform/icons/src/graph/layout.png +++ b/platform/icons/src/graph/layout.png diff --git a/platform/icons/src/graph/nodeSelectionMode.png b/platform/icons/src/graph/nodeSelectionMode.png Binary files differindex d41ef19ed226..5200767b87ff 100644 --- a/platform/icons/src/graph/nodeSelectionMode.png +++ b/platform/icons/src/graph/nodeSelectionMode.png diff --git a/platform/icons/src/graph/print.png b/platform/icons/src/graph/print.png Binary files differindex fd80e277b044..430a401b6ffb 100644 --- a/platform/icons/src/graph/print.png +++ b/platform/icons/src/graph/print.png diff --git a/platform/icons/src/graph/printPreview.png b/platform/icons/src/graph/printPreview.png Binary files differindex 3ef9d7d2231c..24640fa06fef 100644 --- a/platform/icons/src/graph/printPreview.png +++ b/platform/icons/src/graph/printPreview.png diff --git a/platform/icons/src/graph/snapToGrid.png b/platform/icons/src/graph/snapToGrid.png Binary files differindex 00e9903614cb..6d572deab4ed 100644 --- a/platform/icons/src/graph/snapToGrid.png +++ b/platform/icons/src/graph/snapToGrid.png diff --git a/platform/icons/src/graph/zoomIn.png b/platform/icons/src/graph/zoomIn.png Binary files differindex e590c0dbbcdb..d269fb995765 100644 --- a/platform/icons/src/graph/zoomIn.png +++ b/platform/icons/src/graph/zoomIn.png diff --git a/platform/icons/src/graph/zoomOut.png b/platform/icons/src/graph/zoomOut.png Binary files differindex 669e73869bc5..c2f26c72ac89 100644 --- a/platform/icons/src/graph/zoomOut.png +++ b/platform/icons/src/graph/zoomOut.png diff --git a/platform/icons/src/gutter/colors.png b/platform/icons/src/gutter/colors.png Binary files differindex 3544ad6c3c67..cd0dc010178a 100644 --- a/platform/icons/src/gutter/colors.png +++ b/platform/icons/src/gutter/colors.png diff --git a/platform/icons/src/gutter/implementedMethod.png b/platform/icons/src/gutter/implementedMethod.png Binary files differindex f14268f0a021..87fea9d63a8d 100644 --- a/platform/icons/src/gutter/implementedMethod.png +++ b/platform/icons/src/gutter/implementedMethod.png diff --git a/platform/icons/src/gutter/implementingMethod.png b/platform/icons/src/gutter/implementingMethod.png Binary files differindex cc65b2b24d07..f2f90ee00bf2 100644 --- a/platform/icons/src/gutter/implementingMethod.png +++ b/platform/icons/src/gutter/implementingMethod.png diff --git a/platform/icons/src/gutter/overridenMethod.png b/platform/icons/src/gutter/overridenMethod.png Binary files differindex 4af14cd48dca..01f1d9862db9 100644 --- a/platform/icons/src/gutter/overridenMethod.png +++ b/platform/icons/src/gutter/overridenMethod.png diff --git a/platform/icons/src/gutter/overridingMethod.png b/platform/icons/src/gutter/overridingMethod.png Binary files differindex 0539191c6cfd..26e409d43b08 100644 --- a/platform/icons/src/gutter/overridingMethod.png +++ b/platform/icons/src/gutter/overridingMethod.png diff --git a/platform/icons/src/gutter/recursiveMethod.png b/platform/icons/src/gutter/recursiveMethod.png Binary files differindex ce8a48687fff..2980a47758bd 100644 --- a/platform/icons/src/gutter/recursiveMethod.png +++ b/platform/icons/src/gutter/recursiveMethod.png diff --git a/platform/icons/src/gutter/unique.png b/platform/icons/src/gutter/unique.png Binary files differindex 443009c1ee0b..814bfad869bd 100644 --- a/platform/icons/src/gutter/unique.png +++ b/platform/icons/src/gutter/unique.png diff --git a/platform/icons/src/hierarchy/base.png b/platform/icons/src/hierarchy/base.png Binary files differindex 40959155730a..a135cf86b97a 100644 --- a/platform/icons/src/hierarchy/base.png +++ b/platform/icons/src/hierarchy/base.png diff --git a/platform/icons/src/hierarchy/callee.png b/platform/icons/src/hierarchy/callee.png Binary files differindex 034031a494a9..48be54834041 100644 --- a/platform/icons/src/hierarchy/callee.png +++ b/platform/icons/src/hierarchy/callee.png diff --git a/platform/icons/src/hierarchy/caller.png b/platform/icons/src/hierarchy/caller.png Binary files differindex 48f9faec3882..d7fbc2db3788 100644 --- a/platform/icons/src/hierarchy/caller.png +++ b/platform/icons/src/hierarchy/caller.png diff --git a/platform/icons/src/hierarchy/class.png b/platform/icons/src/hierarchy/class.png Binary files differindex ce5f99042f16..b7a4f977b0fa 100644 --- a/platform/icons/src/hierarchy/class.png +++ b/platform/icons/src/hierarchy/class.png diff --git a/platform/icons/src/hierarchy/methodDefined.png b/platform/icons/src/hierarchy/methodDefined.png Binary files differindex 75a4fbdc014a..80b0b3b23a50 100644 --- a/platform/icons/src/hierarchy/methodDefined.png +++ b/platform/icons/src/hierarchy/methodDefined.png diff --git a/platform/icons/src/hierarchy/methodNotDefined.png b/platform/icons/src/hierarchy/methodNotDefined.png Binary files differindex f73ce965ef8c..4108b62e269e 100644 --- a/platform/icons/src/hierarchy/methodNotDefined.png +++ b/platform/icons/src/hierarchy/methodNotDefined.png diff --git a/platform/icons/src/hierarchy/shouldDefineMethod.png b/platform/icons/src/hierarchy/shouldDefineMethod.png Binary files differindex 4042e73dd41c..ac80eb57a563 100644 --- a/platform/icons/src/hierarchy/shouldDefineMethod.png +++ b/platform/icons/src/hierarchy/shouldDefineMethod.png diff --git a/platform/icons/src/hierarchy/subtypes.png b/platform/icons/src/hierarchy/subtypes.png Binary files differindex 034031a494a9..48be54834041 100644 --- a/platform/icons/src/hierarchy/subtypes.png +++ b/platform/icons/src/hierarchy/subtypes.png diff --git a/platform/icons/src/hierarchy/supertypes.png b/platform/icons/src/hierarchy/supertypes.png Binary files differindex 48f9faec3882..d7fbc2db3788 100644 --- a/platform/icons/src/hierarchy/supertypes.png +++ b/platform/icons/src/hierarchy/supertypes.png diff --git a/platform/icons/src/icon_CEsmall.png b/platform/icons/src/icon_CEsmall.png Binary files differindex 781676b09a63..4e25eef40397 100644 --- a/platform/icons/src/icon_CEsmall.png +++ b/platform/icons/src/icon_CEsmall.png diff --git a/platform/icons/src/icon_small.png b/platform/icons/src/icon_small.png Binary files differindex d77a4b6a1d30..1b146c241bc0 100644 --- a/platform/icons/src/icon_small.png +++ b/platform/icons/src/icon_small.png diff --git a/platform/icons/src/icons/ide/nextStepInverted.png b/platform/icons/src/icons/ide/nextStepInverted.png Binary files differindex 8a6665e8c1ac..7113bb8d1487 100644 --- a/platform/icons/src/icons/ide/nextStepInverted.png +++ b/platform/icons/src/icons/ide/nextStepInverted.png diff --git a/platform/icons/src/ide/dnd/bottom.png b/platform/icons/src/ide/dnd/bottom.png Binary files differindex d4e8c3f2b496..84826cc83cb9 100644 --- a/platform/icons/src/ide/dnd/bottom.png +++ b/platform/icons/src/ide/dnd/bottom.png diff --git a/platform/icons/src/ide/dnd/left.png b/platform/icons/src/ide/dnd/left.png Binary files differindex c77d96d0e6bb..480d528c546b 100644 --- a/platform/icons/src/ide/dnd/left.png +++ b/platform/icons/src/ide/dnd/left.png diff --git a/platform/icons/src/ide/dnd/right.png b/platform/icons/src/ide/dnd/right.png Binary files differindex d1eae0a1d59f..0a45a658faa3 100644 --- a/platform/icons/src/ide/dnd/right.png +++ b/platform/icons/src/ide/dnd/right.png diff --git a/platform/icons/src/ide/dnd/top.png b/platform/icons/src/ide/dnd/top.png Binary files differindex ed82f78c379b..bf75e9b50db6 100644 --- a/platform/icons/src/ide/dnd/top.png +++ b/platform/icons/src/ide/dnd/top.png diff --git a/platform/icons/src/ide/emptyFatalError.png b/platform/icons/src/ide/emptyFatalError.png Binary files differindex acedf4488d6e..9d57b19d5f74 100755 --- a/platform/icons/src/ide/emptyFatalError.png +++ b/platform/icons/src/ide/emptyFatalError.png diff --git a/platform/icons/src/ide/error.png b/platform/icons/src/ide/error.png Binary files differindex 2b1a751ebdd7..7ca7e03b12cf 100644 --- a/platform/icons/src/ide/error.png +++ b/platform/icons/src/ide/error.png diff --git a/platform/icons/src/ide/errorPoint.png b/platform/icons/src/ide/errorPoint.png Binary files differindex 2bf963398ed6..55fee60c095a 100644 --- a/platform/icons/src/ide/errorPoint.png +++ b/platform/icons/src/ide/errorPoint.png diff --git a/platform/icons/src/ide/error_notifications.png b/platform/icons/src/ide/error_notifications.png Binary files differindex 3da3b2cdb5f6..c5949ea190a7 100755 --- a/platform/icons/src/ide/error_notifications.png +++ b/platform/icons/src/ide/error_notifications.png diff --git a/platform/icons/src/ide/fatalError-read.png b/platform/icons/src/ide/fatalError-read.png Binary files differindex b7edbad27a8f..78904333853c 100644 --- a/platform/icons/src/ide/fatalError-read.png +++ b/platform/icons/src/ide/fatalError-read.png diff --git a/platform/icons/src/ide/fatalError.png b/platform/icons/src/ide/fatalError.png Binary files differindex 2b1a751ebdd7..7ca7e03b12cf 100755 --- a/platform/icons/src/ide/fatalError.png +++ b/platform/icons/src/ide/fatalError.png diff --git a/platform/icons/src/ide/hectorNo.png b/platform/icons/src/ide/hectorNo.png Binary files differindex 0d736886cc27..7235a91ffd57 100755 --- a/platform/icons/src/ide/hectorNo.png +++ b/platform/icons/src/ide/hectorNo.png diff --git a/platform/icons/src/ide/hectorOff.png b/platform/icons/src/ide/hectorOff.png Binary files differindex ebd8b319dca4..ea48b9b1dc63 100755 --- a/platform/icons/src/ide/hectorOff.png +++ b/platform/icons/src/ide/hectorOff.png diff --git a/platform/icons/src/ide/hectorOn.png b/platform/icons/src/ide/hectorOn.png Binary files differindex a3457e89e9b7..ad487b4a9d9a 100755 --- a/platform/icons/src/ide/hectorOn.png +++ b/platform/icons/src/ide/hectorOn.png diff --git a/platform/icons/src/ide/hectorSyntax.png b/platform/icons/src/ide/hectorSyntax.png Binary files differindex d77037de73ed..293a9f449fac 100644 --- a/platform/icons/src/ide/hectorSyntax.png +++ b/platform/icons/src/ide/hectorSyntax.png diff --git a/platform/icons/src/ide/incomingChangesOff.png b/platform/icons/src/ide/incomingChangesOff.png Binary files differindex 4d048cb32c30..38e0f2f6d641 100755 --- a/platform/icons/src/ide/incomingChangesOff.png +++ b/platform/icons/src/ide/incomingChangesOff.png diff --git a/platform/icons/src/ide/incomingChangesOn.png b/platform/icons/src/ide/incomingChangesOn.png Binary files differindex b3c97a20f2d3..75c8eb8829d1 100755 --- a/platform/icons/src/ide/incomingChangesOn.png +++ b/platform/icons/src/ide/incomingChangesOn.png diff --git a/platform/icons/src/ide/info_notifications.png b/platform/icons/src/ide/info_notifications.png Binary files differindex f9c4e1a8e50e..c916d41a2a8c 100755 --- a/platform/icons/src/ide/info_notifications.png +++ b/platform/icons/src/ide/info_notifications.png diff --git a/platform/icons/src/ide/link.png b/platform/icons/src/ide/link.png Binary files differindex 31085c0d8726..9963749f0ef4 100644 --- a/platform/icons/src/ide/link.png +++ b/platform/icons/src/ide/link.png diff --git a/platform/icons/src/ide/localScope.png b/platform/icons/src/ide/localScope.png Binary files differindex 9c5fe4b43649..d37f9fc6e99f 100644 --- a/platform/icons/src/ide/localScope.png +++ b/platform/icons/src/ide/localScope.png diff --git a/platform/icons/src/ide/lookupAlphanumeric.png b/platform/icons/src/ide/lookupAlphanumeric.png Binary files differindex 93e7f3469cdc..44e3f53ec451 100644 --- a/platform/icons/src/ide/lookupAlphanumeric.png +++ b/platform/icons/src/ide/lookupAlphanumeric.png diff --git a/platform/icons/src/ide/lookupRelevance.png b/platform/icons/src/ide/lookupRelevance.png Binary files differindex 543fbc5a6ba2..a32761812fb2 100644 --- a/platform/icons/src/ide/lookupRelevance.png +++ b/platform/icons/src/ide/lookupRelevance.png diff --git a/platform/icons/src/ide/macro/recording_1.png b/platform/icons/src/ide/macro/recording_1.png Binary files differindex e0ceea8865ad..95064b374546 100644 --- a/platform/icons/src/ide/macro/recording_1.png +++ b/platform/icons/src/ide/macro/recording_1.png diff --git a/platform/icons/src/ide/noNotifications13.png b/platform/icons/src/ide/noNotifications13.png Binary files differindex 282dec0c4e87..de4f5303f59f 100644 --- a/platform/icons/src/ide/noNotifications13.png +++ b/platform/icons/src/ide/noNotifications13.png diff --git a/platform/icons/src/ide/notifications.png b/platform/icons/src/ide/notifications.png Binary files differindex 66a3d318eead..01a675b2bd0d 100755 --- a/platform/icons/src/ide/notifications.png +++ b/platform/icons/src/ide/notifications.png diff --git a/platform/icons/src/ide/pipette.png b/platform/icons/src/ide/pipette.png Binary files differindex 1ad68274530f..e185e7f05d03 100644 --- a/platform/icons/src/ide/pipette.png +++ b/platform/icons/src/ide/pipette.png diff --git a/platform/icons/src/ide/pipette_rollover.png b/platform/icons/src/ide/pipette_rollover.png Binary files differindex d1685c3b8dca..f68fc0699399 100644 --- a/platform/icons/src/ide/pipette_rollover.png +++ b/platform/icons/src/ide/pipette_rollover.png diff --git a/platform/icons/src/ide/rating.png b/platform/icons/src/ide/rating.png Binary files differindex 2f50c2355f00..a53a9a133927 100644 --- a/platform/icons/src/ide/rating.png +++ b/platform/icons/src/ide/rating.png diff --git a/platform/icons/src/ide/rating1.png b/platform/icons/src/ide/rating1.png Binary files differindex 358bf1f6b540..9c4ebd0e5a5b 100644 --- a/platform/icons/src/ide/rating1.png +++ b/platform/icons/src/ide/rating1.png diff --git a/platform/icons/src/ide/rating2.png b/platform/icons/src/ide/rating2.png Binary files differindex ef7eb575df7a..c75534007c11 100644 --- a/platform/icons/src/ide/rating2.png +++ b/platform/icons/src/ide/rating2.png diff --git a/platform/icons/src/ide/rating3.png b/platform/icons/src/ide/rating3.png Binary files differindex 08a8d7f1673a..d48b2a12ec3f 100644 --- a/platform/icons/src/ide/rating3.png +++ b/platform/icons/src/ide/rating3.png diff --git a/platform/icons/src/ide/rating4.png b/platform/icons/src/ide/rating4.png Binary files differindex b4fa11ca0b59..747f29bb1338 100644 --- a/platform/icons/src/ide/rating4.png +++ b/platform/icons/src/ide/rating4.png diff --git a/platform/icons/src/ide/readonly.png b/platform/icons/src/ide/readonly.png Binary files differindex f76b16fc98b4..54c558f967a4 100755 --- a/platform/icons/src/ide/readonly.png +++ b/platform/icons/src/ide/readonly.png diff --git a/platform/icons/src/ide/readwrite.png b/platform/icons/src/ide/readwrite.png Binary files differindex 69022bd8d7a5..0ce7ddcfe92d 100755 --- a/platform/icons/src/ide/readwrite.png +++ b/platform/icons/src/ide/readwrite.png diff --git a/platform/icons/src/ide/shadow/popup/bottom-left.png b/platform/icons/src/ide/shadow/popup/bottom-left.png Binary files differindex b3a17e271e82..17b7f4d2682e 100644 --- a/platform/icons/src/ide/shadow/popup/bottom-left.png +++ b/platform/icons/src/ide/shadow/popup/bottom-left.png diff --git a/platform/icons/src/ide/shadow/popup/bottom-right.png b/platform/icons/src/ide/shadow/popup/bottom-right.png Binary files differindex 351863e41a58..3404aa0dd95f 100644 --- a/platform/icons/src/ide/shadow/popup/bottom-right.png +++ b/platform/icons/src/ide/shadow/popup/bottom-right.png diff --git a/platform/icons/src/ide/shadow/popup/top-left.png b/platform/icons/src/ide/shadow/popup/top-left.png Binary files differindex c5fa4b0e2ed2..3a6ca6530854 100644 --- a/platform/icons/src/ide/shadow/popup/top-left.png +++ b/platform/icons/src/ide/shadow/popup/top-left.png diff --git a/platform/icons/src/ide/shadow/popup/top-right.png b/platform/icons/src/ide/shadow/popup/top-right.png Binary files differindex 63871ed4672c..567bd08fbc83 100644 --- a/platform/icons/src/ide/shadow/popup/top-right.png +++ b/platform/icons/src/ide/shadow/popup/top-right.png diff --git a/platform/icons/src/ide/sharedScope.png b/platform/icons/src/ide/sharedScope.png Binary files differindex f4ca32de672f..d80399c64021 100644 --- a/platform/icons/src/ide/sharedScope.png +++ b/platform/icons/src/ide/sharedScope.png diff --git a/platform/icons/src/ide/statusbar_arrows.png b/platform/icons/src/ide/statusbar_arrows.png Binary files differindex e2e787a58658..7c0c4d6246ae 100644 --- a/platform/icons/src/ide/statusbar_arrows.png +++ b/platform/icons/src/ide/statusbar_arrows.png diff --git a/platform/icons/src/ide/upDown.png b/platform/icons/src/ide/upDown.png Binary files differindex 26a792b41c87..7890550c099d 100644 --- a/platform/icons/src/ide/upDown.png +++ b/platform/icons/src/ide/upDown.png diff --git a/platform/icons/src/ide/warning_notifications.png b/platform/icons/src/ide/warning_notifications.png Binary files differindex b8eea71de9af..c480730c7e36 100755 --- a/platform/icons/src/ide/warning_notifications.png +++ b/platform/icons/src/ide/warning_notifications.png diff --git a/platform/icons/src/idea_logo_background.png b/platform/icons/src/idea_logo_background.png Binary files differindex 86352ccfbd15..7b372a9c2ced 100644 --- a/platform/icons/src/idea_logo_background.png +++ b/platform/icons/src/idea_logo_background.png diff --git a/platform/icons/src/idea_logo_welcome.png b/platform/icons/src/idea_logo_welcome.png Binary files differindex 4ac45515fc85..f77ae1ada1b9 100644 --- a/platform/icons/src/idea_logo_welcome.png +++ b/platform/icons/src/idea_logo_welcome.png diff --git a/platform/icons/src/javaee/dataSourceImport.png b/platform/icons/src/javaee/dataSourceImport.png Binary files differindex 59d06430498d..417055dba923 100644 --- a/platform/icons/src/javaee/dataSourceImport.png +++ b/platform/icons/src/javaee/dataSourceImport.png diff --git a/platform/icons/src/javaee/dbSchemaImportBig.png b/platform/icons/src/javaee/dbSchemaImportBig.png Binary files differindex 983a96f01463..e7b85f70f6ce 100644 --- a/platform/icons/src/javaee/dbSchemaImportBig.png +++ b/platform/icons/src/javaee/dbSchemaImportBig.png diff --git a/platform/icons/src/javaee/jpaFacet.png b/platform/icons/src/javaee/jpaFacet.png Binary files differindex 8a0f77a13e1b..5bc6a74fc625 100644 --- a/platform/icons/src/javaee/jpaFacet.png +++ b/platform/icons/src/javaee/jpaFacet.png diff --git a/platform/icons/src/javaee/updateRunningApplication.png b/platform/icons/src/javaee/updateRunningApplication.png Binary files differindex aca5f14d488f..8b054c2af791 100644 --- a/platform/icons/src/javaee/updateRunningApplication.png +++ b/platform/icons/src/javaee/updateRunningApplication.png diff --git a/platform/icons/src/javaee/web_xml.png b/platform/icons/src/javaee/web_xml.png Binary files differindex ac51ed31cff8..fc32397ca6fc 100644 --- a/platform/icons/src/javaee/web_xml.png +++ b/platform/icons/src/javaee/web_xml.png diff --git a/platform/icons/src/modules/addContentEntry.png b/platform/icons/src/modules/addContentEntry.png Binary files differindex b01ebb323f9f..e21f72616d21 100644 --- a/platform/icons/src/modules/addContentEntry.png +++ b/platform/icons/src/modules/addContentEntry.png diff --git a/platform/icons/src/modules/addExcludedRoot.png b/platform/icons/src/modules/addExcludedRoot.png Binary files differindex bdb47150308b..9c8bdfd2866a 100644 --- a/platform/icons/src/modules/addExcludedRoot.png +++ b/platform/icons/src/modules/addExcludedRoot.png diff --git a/platform/icons/src/modules/annotation.png b/platform/icons/src/modules/annotation.png Binary files differindex 357e060c5544..c30f763ac549 100644 --- a/platform/icons/src/modules/annotation.png +++ b/platform/icons/src/modules/annotation.png diff --git a/platform/icons/src/modules/deleteContentFolder.png b/platform/icons/src/modules/deleteContentFolder.png Binary files differindex 3eb51e888497..d1ab2bb38cac 100644 --- a/platform/icons/src/modules/deleteContentFolder.png +++ b/platform/icons/src/modules/deleteContentFolder.png diff --git a/platform/icons/src/modules/deleteContentFolderRollover.png b/platform/icons/src/modules/deleteContentFolderRollover.png Binary files differindex 241cf81d07f0..6ae30b5527e5 100644 --- a/platform/icons/src/modules/deleteContentFolderRollover.png +++ b/platform/icons/src/modules/deleteContentFolderRollover.png diff --git a/platform/icons/src/modules/deleteContentRoot.png b/platform/icons/src/modules/deleteContentRoot.png Binary files differindex 3eb51e888497..d1ab2bb38cac 100644 --- a/platform/icons/src/modules/deleteContentRoot.png +++ b/platform/icons/src/modules/deleteContentRoot.png diff --git a/platform/icons/src/modules/deleteContentRootRollover.png b/platform/icons/src/modules/deleteContentRootRollover.png Binary files differindex 241cf81d07f0..6ae30b5527e5 100644 --- a/platform/icons/src/modules/deleteContentRootRollover.png +++ b/platform/icons/src/modules/deleteContentRootRollover.png diff --git a/platform/icons/src/modules/edit.png b/platform/icons/src/modules/edit.png Binary files differindex fa4f684c232c..6ba0fd8284d3 100644 --- a/platform/icons/src/modules/edit.png +++ b/platform/icons/src/modules/edit.png diff --git a/platform/icons/src/modules/excludeRoot.png b/platform/icons/src/modules/excludeRoot.png Binary files differindex 0119ae6aa2d1..2b35b8ed0a93 100644 --- a/platform/icons/src/modules/excludeRoot.png +++ b/platform/icons/src/modules/excludeRoot.png diff --git a/platform/icons/src/modules/generatedSourceRoot.png b/platform/icons/src/modules/generatedSourceRoot.png Binary files differindex 56a762075e87..8c375d21b574 100644 --- a/platform/icons/src/modules/generatedSourceRoot.png +++ b/platform/icons/src/modules/generatedSourceRoot.png diff --git a/platform/icons/src/modules/generatedTestRoot.png b/platform/icons/src/modules/generatedTestRoot.png Binary files differindex 114f685c9d6b..51e6e3c1d082 100644 --- a/platform/icons/src/modules/generatedTestRoot.png +++ b/platform/icons/src/modules/generatedTestRoot.png diff --git a/platform/icons/src/modules/library.png b/platform/icons/src/modules/library.png Binary files differindex 2d31e4af69d1..eb8491f78163 100644 --- a/platform/icons/src/modules/library.png +++ b/platform/icons/src/modules/library.png diff --git a/platform/icons/src/modules/merge.png b/platform/icons/src/modules/merge.png Binary files differindex 82ff28f3129e..e26c490ad4f7 100644 --- a/platform/icons/src/modules/merge.png +++ b/platform/icons/src/modules/merge.png diff --git a/platform/icons/src/modules/modulesNode.png b/platform/icons/src/modules/modulesNode.png Binary files differindex aaf36051acc3..5acd2698ca51 100644 --- a/platform/icons/src/modules/modulesNode.png +++ b/platform/icons/src/modules/modulesNode.png diff --git a/platform/icons/src/modules/resourcesRoot.png b/platform/icons/src/modules/resourcesRoot.png Binary files differindex 06ee11a372e3..3a49f51834e6 100644 --- a/platform/icons/src/modules/resourcesRoot.png +++ b/platform/icons/src/modules/resourcesRoot.png diff --git a/platform/icons/src/modules/setPackagePrefix.png b/platform/icons/src/modules/setPackagePrefix.png Binary files differindex 7901c27487ce..0a61c08344b0 100644 --- a/platform/icons/src/modules/setPackagePrefix.png +++ b/platform/icons/src/modules/setPackagePrefix.png diff --git a/platform/icons/src/modules/setPackagePrefixRollover.png b/platform/icons/src/modules/setPackagePrefixRollover.png Binary files differindex c8da49ec447b..db4f5c16d329 100644 --- a/platform/icons/src/modules/setPackagePrefixRollover.png +++ b/platform/icons/src/modules/setPackagePrefixRollover.png diff --git a/platform/icons/src/modules/sourceFolder.png b/platform/icons/src/modules/sourceFolder.png Binary files differindex 429387cca510..1b12a110117e 100644 --- a/platform/icons/src/modules/sourceFolder.png +++ b/platform/icons/src/modules/sourceFolder.png diff --git a/platform/icons/src/modules/sourceRoot.png b/platform/icons/src/modules/sourceRoot.png Binary files differindex 8e143ae32e75..4c9998629dab 100644 --- a/platform/icons/src/modules/sourceRoot.png +++ b/platform/icons/src/modules/sourceRoot.png diff --git a/platform/icons/src/modules/split.png b/platform/icons/src/modules/split.png Binary files differindex 89d996faae02..27518d342b0e 100644 --- a/platform/icons/src/modules/split.png +++ b/platform/icons/src/modules/split.png diff --git a/platform/icons/src/modules/testResourcesRoot.png b/platform/icons/src/modules/testResourcesRoot.png Binary files differindex b343688a53b3..ba94d2632ff8 100644 --- a/platform/icons/src/modules/testResourcesRoot.png +++ b/platform/icons/src/modules/testResourcesRoot.png diff --git a/platform/icons/src/modules/testRoot.png b/platform/icons/src/modules/testRoot.png Binary files differindex 324df52ae5cd..e0cc91ee27d0 100644 --- a/platform/icons/src/modules/testRoot.png +++ b/platform/icons/src/modules/testRoot.png diff --git a/platform/icons/src/modules/testSourceFolder.png b/platform/icons/src/modules/testSourceFolder.png Binary files differindex c646c9478d3b..412ee19caa18 100644 --- a/platform/icons/src/modules/testSourceFolder.png +++ b/platform/icons/src/modules/testSourceFolder.png diff --git a/platform/icons/src/modules/types/JavaeeAppModule.png b/platform/icons/src/modules/types/JavaeeAppModule.png Binary files differindex 1b6c368aee38..0cfbf4d53e77 100644 --- a/platform/icons/src/modules/types/JavaeeAppModule.png +++ b/platform/icons/src/modules/types/JavaeeAppModule.png diff --git a/platform/icons/src/modules/types/emptyProjectType.png b/platform/icons/src/modules/types/emptyProjectType.png Binary files differindex 36ed04db4f01..639ad5701228 100644 --- a/platform/icons/src/modules/types/emptyProjectType.png +++ b/platform/icons/src/modules/types/emptyProjectType.png diff --git a/platform/icons/src/modules/types/javaModule.png b/platform/icons/src/modules/types/javaModule.png Binary files differindex 5a040c86a354..1c294793adb8 100644 --- a/platform/icons/src/modules/types/javaModule.png +++ b/platform/icons/src/modules/types/javaModule.png diff --git a/platform/icons/src/modules/types/pluginModule.png b/platform/icons/src/modules/types/pluginModule.png Binary files differindex 7f5e106be8c6..65e319383a05 100644 --- a/platform/icons/src/modules/types/pluginModule.png +++ b/platform/icons/src/modules/types/pluginModule.png diff --git a/platform/icons/src/modules/types/userDefined.png b/platform/icons/src/modules/types/userDefined.png Binary files differindex aaf940aba9bb..a5a183ced998 100644 --- a/platform/icons/src/modules/types/userDefined.png +++ b/platform/icons/src/modules/types/userDefined.png diff --git a/platform/icons/src/modules/types/webModule.png b/platform/icons/src/modules/types/webModule.png Binary files differindex affdb0f48688..528314e5ed49 100644 --- a/platform/icons/src/modules/types/webModule.png +++ b/platform/icons/src/modules/types/webModule.png diff --git a/platform/icons/src/modules/unmarkWebroot.png b/platform/icons/src/modules/unmarkWebroot.png Binary files differindex dfafeb04e6cd..b5f129fe0081 100644 --- a/platform/icons/src/modules/unmarkWebroot.png +++ b/platform/icons/src/modules/unmarkWebroot.png diff --git a/platform/icons/src/modules/webRoot.png b/platform/icons/src/modules/webRoot.png Binary files differindex 527d5d5bd3cd..ebae0f147db1 100644 --- a/platform/icons/src/modules/webRoot.png +++ b/platform/icons/src/modules/webRoot.png diff --git a/platform/icons/src/nodes/DataSource.png b/platform/icons/src/nodes/DataSource.png Binary files differindex b4584f3fa71f..a3be26670530 100644 --- a/platform/icons/src/nodes/DataSource.png +++ b/platform/icons/src/nodes/DataSource.png diff --git a/platform/icons/src/nodes/DataTables.png b/platform/icons/src/nodes/DataTables.png Binary files differindex 1e61b0ab2d93..2ee020a0ebf5 100644 --- a/platform/icons/src/nodes/DataTables.png +++ b/platform/icons/src/nodes/DataTables.png diff --git a/platform/icons/src/nodes/Module.png b/platform/icons/src/nodes/Module.png Binary files differindex 7d2508175684..03395f08895c 100644 --- a/platform/icons/src/nodes/Module.png +++ b/platform/icons/src/nodes/Module.png diff --git a/platform/icons/src/nodes/SecurityRole.png b/platform/icons/src/nodes/SecurityRole.png Binary files differindex dd009ed6d551..b9c4c02e52a2 100644 --- a/platform/icons/src/nodes/SecurityRole.png +++ b/platform/icons/src/nodes/SecurityRole.png diff --git a/platform/icons/src/nodes/TreeClosed.png b/platform/icons/src/nodes/TreeClosed.png Binary files differindex a34ff6e43631..c7933ec0b576 100644 --- a/platform/icons/src/nodes/TreeClosed.png +++ b/platform/icons/src/nodes/TreeClosed.png diff --git a/platform/icons/src/nodes/TreeOpen.png b/platform/icons/src/nodes/TreeOpen.png Binary files differindex a34ff6e43631..c7933ec0b576 100644 --- a/platform/icons/src/nodes/TreeOpen.png +++ b/platform/icons/src/nodes/TreeOpen.png diff --git a/platform/icons/src/nodes/abstractClass.png b/platform/icons/src/nodes/abstractClass.png Binary files differindex 714f6840955f..b634fab9a3ee 100644 --- a/platform/icons/src/nodes/abstractClass.png +++ b/platform/icons/src/nodes/abstractClass.png diff --git a/platform/icons/src/nodes/abstractException.png b/platform/icons/src/nodes/abstractException.png Binary files differindex 044b35be1fc1..fa4c2d347055 100644 --- a/platform/icons/src/nodes/abstractException.png +++ b/platform/icons/src/nodes/abstractException.png diff --git a/platform/icons/src/nodes/abstractMethod.png b/platform/icons/src/nodes/abstractMethod.png Binary files differindex 9ca0c544c1ef..65bb17da4577 100644 --- a/platform/icons/src/nodes/abstractMethod.png +++ b/platform/icons/src/nodes/abstractMethod.png diff --git a/platform/icons/src/nodes/advice.png b/platform/icons/src/nodes/advice.png Binary files differindex 4df9924006d7..c8b26abca0a4 100644 --- a/platform/icons/src/nodes/advice.png +++ b/platform/icons/src/nodes/advice.png diff --git a/platform/icons/src/nodes/annotationtype.png b/platform/icons/src/nodes/annotationtype.png Binary files differindex dbd01ebb9df0..63115e4d2108 100644 --- a/platform/icons/src/nodes/annotationtype.png +++ b/platform/icons/src/nodes/annotationtype.png diff --git a/platform/icons/src/nodes/anonymousClass.png b/platform/icons/src/nodes/anonymousClass.png Binary files differindex ba8d3c397146..f68c0208ecaa 100644 --- a/platform/icons/src/nodes/anonymousClass.png +++ b/platform/icons/src/nodes/anonymousClass.png diff --git a/platform/icons/src/nodes/artifact.png b/platform/icons/src/nodes/artifact.png Binary files differindex ec9d240c7864..84b49e2539a3 100644 --- a/platform/icons/src/nodes/artifact.png +++ b/platform/icons/src/nodes/artifact.png diff --git a/platform/icons/src/nodes/c_plocal.png b/platform/icons/src/nodes/c_plocal.png Binary files differindex 8a081bef313e..8f36dba192f2 100644 --- a/platform/icons/src/nodes/c_plocal.png +++ b/platform/icons/src/nodes/c_plocal.png diff --git a/platform/icons/src/nodes/c_private.png b/platform/icons/src/nodes/c_private.png Binary files differindex fd127d6e5811..700950f4461a 100644 --- a/platform/icons/src/nodes/c_private.png +++ b/platform/icons/src/nodes/c_private.png diff --git a/platform/icons/src/nodes/c_protected.png b/platform/icons/src/nodes/c_protected.png Binary files differindex ab0d72ffc87b..b3e1af68734e 100644 --- a/platform/icons/src/nodes/c_protected.png +++ b/platform/icons/src/nodes/c_protected.png diff --git a/platform/icons/src/nodes/c_public.png b/platform/icons/src/nodes/c_public.png Binary files differindex 74784192b953..dc3321d7e32d 100644 --- a/platform/icons/src/nodes/c_public.png +++ b/platform/icons/src/nodes/c_public.png diff --git a/platform/icons/src/nodes/class.png b/platform/icons/src/nodes/class.png Binary files differindex fca58be1de19..98337ca8a14b 100644 --- a/platform/icons/src/nodes/class.png +++ b/platform/icons/src/nodes/class.png diff --git a/platform/icons/src/nodes/classInitializer.png b/platform/icons/src/nodes/classInitializer.png Binary files differindex d5996ee401fe..7ec88939b6ad 100644 --- a/platform/icons/src/nodes/classInitializer.png +++ b/platform/icons/src/nodes/classInitializer.png diff --git a/platform/icons/src/nodes/collapseNode.png b/platform/icons/src/nodes/collapseNode.png Binary files differindex 409bde26096e..7805d8654c61 100644 --- a/platform/icons/src/nodes/collapseNode.png +++ b/platform/icons/src/nodes/collapseNode.png diff --git a/platform/icons/src/nodes/compiledClassesFolder.png b/platform/icons/src/nodes/compiledClassesFolder.png Binary files differindex f96d2206d863..cdf8cad28422 100644 --- a/platform/icons/src/nodes/compiledClassesFolder.png +++ b/platform/icons/src/nodes/compiledClassesFolder.png diff --git a/platform/icons/src/nodes/copyOfFolder.png b/platform/icons/src/nodes/copyOfFolder.png Binary files differindex bc3502165cf7..274487dfdda4 100644 --- a/platform/icons/src/nodes/copyOfFolder.png +++ b/platform/icons/src/nodes/copyOfFolder.png diff --git a/platform/icons/src/nodes/cvs_global.png b/platform/icons/src/nodes/cvs_global.png Binary files differindex 10c01a85f926..131c2b3fa223 100644 --- a/platform/icons/src/nodes/cvs_global.png +++ b/platform/icons/src/nodes/cvs_global.png diff --git a/platform/icons/src/nodes/cvs_roots.png b/platform/icons/src/nodes/cvs_roots.png Binary files differindex 98d8ff2fc551..88d558db42b6 100644 --- a/platform/icons/src/nodes/cvs_roots.png +++ b/platform/icons/src/nodes/cvs_roots.png diff --git a/platform/icons/src/nodes/dataColumn.png b/platform/icons/src/nodes/dataColumn.png Binary files differindex 81c8e7872a8b..c298d2e92854 100644 --- a/platform/icons/src/nodes/dataColumn.png +++ b/platform/icons/src/nodes/dataColumn.png diff --git a/platform/icons/src/nodes/dataSchema.png b/platform/icons/src/nodes/dataSchema.png Binary files differindex 4ad411fbe77e..7c9c24f16270 100644 --- a/platform/icons/src/nodes/dataSchema.png +++ b/platform/icons/src/nodes/dataSchema.png diff --git a/platform/icons/src/nodes/dataView.png b/platform/icons/src/nodes/dataView.png Binary files differindex de8ff33ea6c7..31e234b3c41c 100644 --- a/platform/icons/src/nodes/dataView.png +++ b/platform/icons/src/nodes/dataView.png diff --git a/platform/icons/src/nodes/deploy.png b/platform/icons/src/nodes/deploy.png Binary files differindex 4b4380a85ce8..c830dedb2b6d 100644 --- a/platform/icons/src/nodes/deploy.png +++ b/platform/icons/src/nodes/deploy.png diff --git a/platform/icons/src/nodes/ejb.png b/platform/icons/src/nodes/ejb.png Binary files differindex 544952b6a137..52e7bb1e6475 100644 --- a/platform/icons/src/nodes/ejb.png +++ b/platform/icons/src/nodes/ejb.png diff --git a/platform/icons/src/nodes/ejbBusinessMethod.png b/platform/icons/src/nodes/ejbBusinessMethod.png Binary files differindex 69900b9658a6..69275e0a59d6 100644 --- a/platform/icons/src/nodes/ejbBusinessMethod.png +++ b/platform/icons/src/nodes/ejbBusinessMethod.png diff --git a/platform/icons/src/nodes/ejbCmpField.png b/platform/icons/src/nodes/ejbCmpField.png Binary files differindex ca9aa4691e30..09c8ffef68ac 100644 --- a/platform/icons/src/nodes/ejbCmpField.png +++ b/platform/icons/src/nodes/ejbCmpField.png diff --git a/platform/icons/src/nodes/ejbCmrField.png b/platform/icons/src/nodes/ejbCmrField.png Binary files differindex 4e72f8682a08..518debf73a61 100644 --- a/platform/icons/src/nodes/ejbCmrField.png +++ b/platform/icons/src/nodes/ejbCmrField.png diff --git a/platform/icons/src/nodes/ejbFinderMethod.png b/platform/icons/src/nodes/ejbFinderMethod.png Binary files differindex 51574141c925..ffa862abf564 100644 --- a/platform/icons/src/nodes/ejbFinderMethod.png +++ b/platform/icons/src/nodes/ejbFinderMethod.png diff --git a/platform/icons/src/nodes/ejbPrimaryKeyClass.png b/platform/icons/src/nodes/ejbPrimaryKeyClass.png Binary files differindex 4fda4fbb46ab..1d61839900ca 100644 --- a/platform/icons/src/nodes/ejbPrimaryKeyClass.png +++ b/platform/icons/src/nodes/ejbPrimaryKeyClass.png diff --git a/platform/icons/src/nodes/ejbReference.png b/platform/icons/src/nodes/ejbReference.png Binary files differindex 2f00d8f418ab..1aec01cb5e59 100644 --- a/platform/icons/src/nodes/ejbReference.png +++ b/platform/icons/src/nodes/ejbReference.png diff --git a/platform/icons/src/nodes/enterpriseProject.png b/platform/icons/src/nodes/enterpriseProject.png Binary files differindex e5bb5046d10c..3353c7955590 100644 --- a/platform/icons/src/nodes/enterpriseProject.png +++ b/platform/icons/src/nodes/enterpriseProject.png diff --git a/platform/icons/src/nodes/entryPoints.png b/platform/icons/src/nodes/entryPoints.png Binary files differindex 5276de18605f..9494f2d0c72e 100644 --- a/platform/icons/src/nodes/entryPoints.png +++ b/platform/icons/src/nodes/entryPoints.png diff --git a/platform/icons/src/nodes/enum.png b/platform/icons/src/nodes/enum.png Binary files differindex 7ed6ac47955a..4c3395aaa088 100644 --- a/platform/icons/src/nodes/enum.png +++ b/platform/icons/src/nodes/enum.png diff --git a/platform/icons/src/nodes/errorIntroduction.png b/platform/icons/src/nodes/errorIntroduction.png Binary files differindex d09956ff91be..bdca36e2deb9 100644 --- a/platform/icons/src/nodes/errorIntroduction.png +++ b/platform/icons/src/nodes/errorIntroduction.png diff --git a/platform/icons/src/nodes/errorMark.png b/platform/icons/src/nodes/errorMark.png Binary files differindex 9db58ea7a9d9..a05eb087b8e9 100644 --- a/platform/icons/src/nodes/errorMark.png +++ b/platform/icons/src/nodes/errorMark.png diff --git a/platform/icons/src/nodes/exceptionClass.png b/platform/icons/src/nodes/exceptionClass.png Binary files differindex 8bec145717a4..a3736911d988 100644 --- a/platform/icons/src/nodes/exceptionClass.png +++ b/platform/icons/src/nodes/exceptionClass.png diff --git a/platform/icons/src/nodes/excludedFromCompile.png b/platform/icons/src/nodes/excludedFromCompile.png Binary files differindex 579f5efdaf31..78636a57165f 100644 --- a/platform/icons/src/nodes/excludedFromCompile.png +++ b/platform/icons/src/nodes/excludedFromCompile.png diff --git a/platform/icons/src/nodes/expandNode.png b/platform/icons/src/nodes/expandNode.png Binary files differindex f5841b8c0120..3efe3e2d773b 100644 --- a/platform/icons/src/nodes/expandNode.png +++ b/platform/icons/src/nodes/expandNode.png diff --git a/platform/icons/src/nodes/field.png b/platform/icons/src/nodes/field.png Binary files differindex ffa9ccb1a01b..7c91fcfc5b7f 100644 --- a/platform/icons/src/nodes/field.png +++ b/platform/icons/src/nodes/field.png diff --git a/platform/icons/src/nodes/fieldPK.png b/platform/icons/src/nodes/fieldPK.png Binary files differindex eef919cc22bf..c395c9d5893e 100644 --- a/platform/icons/src/nodes/fieldPK.png +++ b/platform/icons/src/nodes/fieldPK.png diff --git a/platform/icons/src/nodes/finalMark.png b/platform/icons/src/nodes/finalMark.png Binary files differindex 5862a302f3bf..07108b11e771 100644 --- a/platform/icons/src/nodes/finalMark.png +++ b/platform/icons/src/nodes/finalMark.png diff --git a/platform/icons/src/nodes/folder.png b/platform/icons/src/nodes/folder.png Binary files differindex a34ff6e43631..c7933ec0b576 100644 --- a/platform/icons/src/nodes/folder.png +++ b/platform/icons/src/nodes/folder.png diff --git a/platform/icons/src/nodes/function.png b/platform/icons/src/nodes/function.png Binary files differindex 765efe88774b..056b38c4bf34 100644 --- a/platform/icons/src/nodes/function.png +++ b/platform/icons/src/nodes/function.png diff --git a/platform/icons/src/nodes/homeFolder.png b/platform/icons/src/nodes/homeFolder.png Binary files differindex e3b4e194048e..e0038480ced0 100644 --- a/platform/icons/src/nodes/homeFolder.png +++ b/platform/icons/src/nodes/homeFolder.png diff --git a/platform/icons/src/nodes/ideaModule.png b/platform/icons/src/nodes/ideaModule.png Binary files differindex e5bb5046d10c..3353c7955590 100644 --- a/platform/icons/src/nodes/ideaModule.png +++ b/platform/icons/src/nodes/ideaModule.png diff --git a/platform/icons/src/nodes/ideaProject.png b/platform/icons/src/nodes/ideaProject.png Binary files differindex 4248301a9bd5..3353c7955590 100644 --- a/platform/icons/src/nodes/ideaProject.png +++ b/platform/icons/src/nodes/ideaProject.png diff --git a/platform/icons/src/nodes/ideaWorkspace.png b/platform/icons/src/nodes/ideaWorkspace.png Binary files differindex 4248301a9bd5..3353c7955590 100644 --- a/platform/icons/src/nodes/ideaWorkspace.png +++ b/platform/icons/src/nodes/ideaWorkspace.png diff --git a/platform/icons/src/nodes/inspectionResults.png b/platform/icons/src/nodes/inspectionResults.png Binary files differindex ecb606c9105b..a77b4aa64f9f 100644 --- a/platform/icons/src/nodes/inspectionResults.png +++ b/platform/icons/src/nodes/inspectionResults.png diff --git a/platform/icons/src/nodes/interface.png b/platform/icons/src/nodes/interface.png Binary files differindex e1e56603db9a..f98b1aa26a9d 100644 --- a/platform/icons/src/nodes/interface.png +++ b/platform/icons/src/nodes/interface.png diff --git a/platform/icons/src/nodes/j2eeParameter.png b/platform/icons/src/nodes/j2eeParameter.png Binary files differindex 02629ca8cd6f..7ec88939b6ad 100644 --- a/platform/icons/src/nodes/j2eeParameter.png +++ b/platform/icons/src/nodes/j2eeParameter.png diff --git a/platform/icons/src/nodes/jarDirectory.png b/platform/icons/src/nodes/jarDirectory.png Binary files differindex d3c1d8313428..9d519159ba94 100644 --- a/platform/icons/src/nodes/jarDirectory.png +++ b/platform/icons/src/nodes/jarDirectory.png diff --git a/platform/icons/src/nodes/javaDocFolder.png b/platform/icons/src/nodes/javaDocFolder.png Binary files differindex 0c27149e24fc..7c4af45ce291 100644 --- a/platform/icons/src/nodes/javaDocFolder.png +++ b/platform/icons/src/nodes/javaDocFolder.png diff --git a/platform/icons/src/nodes/jsf/component.png b/platform/icons/src/nodes/jsf/component.png Binary files differindex 244c8c36a973..18494afbafab 100644 --- a/platform/icons/src/nodes/jsf/component.png +++ b/platform/icons/src/nodes/jsf/component.png diff --git a/platform/icons/src/nodes/junitTestMark.png b/platform/icons/src/nodes/junitTestMark.png Binary files differindex 456dd70d630a..1614759f7f07 100644 --- a/platform/icons/src/nodes/junitTestMark.png +++ b/platform/icons/src/nodes/junitTestMark.png diff --git a/platform/icons/src/nodes/keymapAnt.png b/platform/icons/src/nodes/keymapAnt.png Binary files differindex cf1e34139a93..5baac07c6676 100644 --- a/platform/icons/src/nodes/keymapAnt.png +++ b/platform/icons/src/nodes/keymapAnt.png diff --git a/platform/icons/src/nodes/keymapEditor.png b/platform/icons/src/nodes/keymapEditor.png Binary files differindex 9e52a4ba3bc0..47c9d87b4100 100644 --- a/platform/icons/src/nodes/keymapEditor.png +++ b/platform/icons/src/nodes/keymapEditor.png diff --git a/platform/icons/src/nodes/keymapMainMenu.png b/platform/icons/src/nodes/keymapMainMenu.png Binary files differindex 2c427c7d1d8f..7092b76c7bf5 100644 --- a/platform/icons/src/nodes/keymapMainMenu.png +++ b/platform/icons/src/nodes/keymapMainMenu.png diff --git a/platform/icons/src/nodes/keymapOther.png b/platform/icons/src/nodes/keymapOther.png Binary files differindex a3cf6daa6f66..8ba92bb6928e 100644 --- a/platform/icons/src/nodes/keymapOther.png +++ b/platform/icons/src/nodes/keymapOther.png diff --git a/platform/icons/src/nodes/keymapTools.png b/platform/icons/src/nodes/keymapTools.png Binary files differindex 2c04e34d4e46..1c5d3aa05ec0 100644 --- a/platform/icons/src/nodes/keymapTools.png +++ b/platform/icons/src/nodes/keymapTools.png diff --git a/platform/icons/src/nodes/locked.png b/platform/icons/src/nodes/locked.png Binary files differindex 0b967283a42e..106e1b486ad8 100644 --- a/platform/icons/src/nodes/locked.png +++ b/platform/icons/src/nodes/locked.png diff --git a/platform/icons/src/nodes/method.png b/platform/icons/src/nodes/method.png Binary files differindex a05eeee81748..b55765f939da 100644 --- a/platform/icons/src/nodes/method.png +++ b/platform/icons/src/nodes/method.png diff --git a/platform/icons/src/nodes/moduleGroup.png b/platform/icons/src/nodes/moduleGroup.png Binary files differindex 5a20447f8726..c323909e3b5d 100644 --- a/platform/icons/src/nodes/moduleGroup.png +++ b/platform/icons/src/nodes/moduleGroup.png diff --git a/platform/icons/src/nodes/newFolder.png b/platform/icons/src/nodes/newFolder.png Binary files differindex a34ff6e43631..c7933ec0b576 100644 --- a/platform/icons/src/nodes/newFolder.png +++ b/platform/icons/src/nodes/newFolder.png diff --git a/platform/icons/src/nodes/package.png b/platform/icons/src/nodes/package.png Binary files differindex 813cb2442b4d..d24477686e75 100644 --- a/platform/icons/src/nodes/package.png +++ b/platform/icons/src/nodes/package.png diff --git a/platform/icons/src/nodes/padlock.png b/platform/icons/src/nodes/padlock.png Binary files differindex 9a68222d2611..ba6bd350006c 100644 --- a/platform/icons/src/nodes/padlock.png +++ b/platform/icons/src/nodes/padlock.png diff --git a/platform/icons/src/nodes/parameter.png b/platform/icons/src/nodes/parameter.png Binary files differindex 1278ae24deb0..14f14f52094d 100644 --- a/platform/icons/src/nodes/parameter.png +++ b/platform/icons/src/nodes/parameter.png diff --git a/platform/icons/src/nodes/pinToolWindow.png b/platform/icons/src/nodes/pinToolWindow.png Binary files differindex e0d6da020436..0b4e36249e22 100644 --- a/platform/icons/src/nodes/pinToolWindow.png +++ b/platform/icons/src/nodes/pinToolWindow.png diff --git a/platform/icons/src/nodes/plugin.png b/platform/icons/src/nodes/plugin.png Binary files differindex d52f4a650d15..c15a6a0bfc64 100644 --- a/platform/icons/src/nodes/plugin.png +++ b/platform/icons/src/nodes/plugin.png diff --git a/platform/icons/src/nodes/pluginnotinstalled.png b/platform/icons/src/nodes/pluginnotinstalled.png Binary files differindex 2c4c7700a3b3..1733115b997f 100644 --- a/platform/icons/src/nodes/pluginnotinstalled.png +++ b/platform/icons/src/nodes/pluginnotinstalled.png diff --git a/platform/icons/src/nodes/pluginobsolete.png b/platform/icons/src/nodes/pluginobsolete.png Binary files differindex 89dfc6052175..1f6f9e084b89 100644 --- a/platform/icons/src/nodes/pluginobsolete.png +++ b/platform/icons/src/nodes/pluginobsolete.png diff --git a/platform/icons/src/nodes/pointcut.png b/platform/icons/src/nodes/pointcut.png Binary files differindex b957db002507..3a06c6880bd5 100644 --- a/platform/icons/src/nodes/pointcut.png +++ b/platform/icons/src/nodes/pointcut.png diff --git a/platform/icons/src/nodes/ppFile.png b/platform/icons/src/nodes/ppFile.png Binary files differindex a34ff6e43631..c7933ec0b576 100644 --- a/platform/icons/src/nodes/ppFile.png +++ b/platform/icons/src/nodes/ppFile.png diff --git a/platform/icons/src/nodes/ppInvalid.png b/platform/icons/src/nodes/ppInvalid.png Binary files differindex 8fb0689e9bb8..68eb2f7b6bd0 100644 --- a/platform/icons/src/nodes/ppInvalid.png +++ b/platform/icons/src/nodes/ppInvalid.png diff --git a/platform/icons/src/nodes/ppJar.png b/platform/icons/src/nodes/ppJar.png Binary files differindex 433c8d9d18df..79baf02db126 100644 --- a/platform/icons/src/nodes/ppJar.png +++ b/platform/icons/src/nodes/ppJar.png diff --git a/platform/icons/src/nodes/ppJdk.png b/platform/icons/src/nodes/ppJdk.png Binary files differindex 82b906ecbc2a..05082cf459d2 100644 --- a/platform/icons/src/nodes/ppJdk.png +++ b/platform/icons/src/nodes/ppJdk.png diff --git a/platform/icons/src/nodes/ppLib.png b/platform/icons/src/nodes/ppLib.png Binary files differindex 048bcf6dfa83..576d3e79a01c 100644 --- a/platform/icons/src/nodes/ppLib.png +++ b/platform/icons/src/nodes/ppLib.png diff --git a/platform/icons/src/nodes/ppLibFolder.png b/platform/icons/src/nodes/ppLibFolder.png Binary files differindex b08d090803b0..169fcc996add 100644 --- a/platform/icons/src/nodes/ppLibFolder.png +++ b/platform/icons/src/nodes/ppLibFolder.png diff --git a/platform/icons/src/nodes/ppWeb.png b/platform/icons/src/nodes/ppWeb.png Binary files differindex fb05d36929f9..7bfc4d3858e7 100644 --- a/platform/icons/src/nodes/ppWeb.png +++ b/platform/icons/src/nodes/ppWeb.png diff --git a/platform/icons/src/nodes/project.png b/platform/icons/src/nodes/project.png Binary files differindex 6c4038d795ac..1a6eb488eec8 100644 --- a/platform/icons/src/nodes/project.png +++ b/platform/icons/src/nodes/project.png diff --git a/platform/icons/src/nodes/property.png b/platform/icons/src/nodes/property.png Binary files differindex ef848d3a8d86..3a06c6880bd5 100644 --- a/platform/icons/src/nodes/property.png +++ b/platform/icons/src/nodes/property.png diff --git a/platform/icons/src/nodes/propertyRead.png b/platform/icons/src/nodes/propertyRead.png Binary files differindex f6fbe95e6ae7..b7f4f0995db3 100644 --- a/platform/icons/src/nodes/propertyRead.png +++ b/platform/icons/src/nodes/propertyRead.png diff --git a/platform/icons/src/nodes/propertyReadStatic.png b/platform/icons/src/nodes/propertyReadStatic.png Binary files differindex 313858227163..97104815a103 100644 --- a/platform/icons/src/nodes/propertyReadStatic.png +++ b/platform/icons/src/nodes/propertyReadStatic.png diff --git a/platform/icons/src/nodes/propertyReadWrite.png b/platform/icons/src/nodes/propertyReadWrite.png Binary files differindex aa007daefb6e..1611f5cbd1f0 100644 --- a/platform/icons/src/nodes/propertyReadWrite.png +++ b/platform/icons/src/nodes/propertyReadWrite.png diff --git a/platform/icons/src/nodes/propertyReadWriteStatic.png b/platform/icons/src/nodes/propertyReadWriteStatic.png Binary files differindex 03ac95b86c6c..45f16756383e 100644 --- a/platform/icons/src/nodes/propertyReadWriteStatic.png +++ b/platform/icons/src/nodes/propertyReadWriteStatic.png diff --git a/platform/icons/src/nodes/propertyWrite.png b/platform/icons/src/nodes/propertyWrite.png Binary files differindex 08ddd9d7588f..4fb6179d4221 100644 --- a/platform/icons/src/nodes/propertyWrite.png +++ b/platform/icons/src/nodes/propertyWrite.png diff --git a/platform/icons/src/nodes/propertyWriteStatic.png b/platform/icons/src/nodes/propertyWriteStatic.png Binary files differindex 83dda35d9318..6005e9c86839 100644 --- a/platform/icons/src/nodes/propertyWriteStatic.png +++ b/platform/icons/src/nodes/propertyWriteStatic.png diff --git a/platform/icons/src/nodes/read-access.png b/platform/icons/src/nodes/read-access.png Binary files differindex 5dc86294cd86..6eea4cecf481 100644 --- a/platform/icons/src/nodes/read-access.png +++ b/platform/icons/src/nodes/read-access.png diff --git a/platform/icons/src/nodes/resourceBundle.png b/platform/icons/src/nodes/resourceBundle.png Binary files differindex 3b592f960727..521d4387f672 100644 --- a/platform/icons/src/nodes/resourceBundle.png +++ b/platform/icons/src/nodes/resourceBundle.png diff --git a/platform/icons/src/nodes/runnableMark.png b/platform/icons/src/nodes/runnableMark.png Binary files differindex a96cc466a2aa..52e0d60ffbd4 100644 --- a/platform/icons/src/nodes/runnableMark.png +++ b/platform/icons/src/nodes/runnableMark.png diff --git a/platform/icons/src/nodes/sortBySeverity.png b/platform/icons/src/nodes/sortBySeverity.png Binary files differindex f7a10d1dd5a9..c79164123d62 100644 --- a/platform/icons/src/nodes/sortBySeverity.png +++ b/platform/icons/src/nodes/sortBySeverity.png diff --git a/platform/icons/src/nodes/sourceFolder.png b/platform/icons/src/nodes/sourceFolder.png Binary files differindex 67145d116cd8..1b12a110117e 100644 --- a/platform/icons/src/nodes/sourceFolder.png +++ b/platform/icons/src/nodes/sourceFolder.png diff --git a/platform/icons/src/nodes/static.png b/platform/icons/src/nodes/static.png Binary files differindex 12d12e587aeb..f227f1a3d994 100644 --- a/platform/icons/src/nodes/static.png +++ b/platform/icons/src/nodes/static.png diff --git a/platform/icons/src/nodes/staticMark.png b/platform/icons/src/nodes/staticMark.png Binary files differindex 753c6957e751..349b0a85020d 100644 --- a/platform/icons/src/nodes/staticMark.png +++ b/platform/icons/src/nodes/staticMark.png diff --git a/platform/icons/src/nodes/symlink.png b/platform/icons/src/nodes/symlink.png Binary files differindex ff70fc1edf48..1bb3f5dac9ea 100644 --- a/platform/icons/src/nodes/symlink.png +++ b/platform/icons/src/nodes/symlink.png diff --git a/platform/icons/src/nodes/tabAlert.png b/platform/icons/src/nodes/tabAlert.png Binary files differindex 50bd39091ca2..831ccd4ca20e 100644 --- a/platform/icons/src/nodes/tabAlert.png +++ b/platform/icons/src/nodes/tabAlert.png diff --git a/platform/icons/src/nodes/tabPin.png b/platform/icons/src/nodes/tabPin.png Binary files differindex 80f111867193..e164d9b26c8c 100644 --- a/platform/icons/src/nodes/tabPin.png +++ b/platform/icons/src/nodes/tabPin.png diff --git a/platform/icons/src/nodes/tag.png b/platform/icons/src/nodes/tag.png Binary files differindex 4df9924006d7..c8b26abca0a4 100644 --- a/platform/icons/src/nodes/tag.png +++ b/platform/icons/src/nodes/tag.png diff --git a/platform/icons/src/nodes/testSourceFolder.png b/platform/icons/src/nodes/testSourceFolder.png Binary files differindex 5c3994de9d2a..80baa67446e4 100644 --- a/platform/icons/src/nodes/testSourceFolder.png +++ b/platform/icons/src/nodes/testSourceFolder.png diff --git a/platform/icons/src/nodes/treeCollapseNode.png b/platform/icons/src/nodes/treeCollapseNode.png Binary files differindex 1eba24f5449a..ffc1b211a8f4 100644 --- a/platform/icons/src/nodes/treeCollapseNode.png +++ b/platform/icons/src/nodes/treeCollapseNode.png diff --git a/platform/icons/src/nodes/treeDownArrow.png b/platform/icons/src/nodes/treeDownArrow.png Binary files differindex f10b84def7e2..5df289cae908 100644 --- a/platform/icons/src/nodes/treeDownArrow.png +++ b/platform/icons/src/nodes/treeDownArrow.png diff --git a/platform/icons/src/nodes/treeExpandNode.png b/platform/icons/src/nodes/treeExpandNode.png Binary files differindex 6f02a2610292..15f305a7813e 100644 --- a/platform/icons/src/nodes/treeExpandNode.png +++ b/platform/icons/src/nodes/treeExpandNode.png diff --git a/platform/icons/src/nodes/treeRightArrow.png b/platform/icons/src/nodes/treeRightArrow.png Binary files differindex 1bff9016044d..d917eaf5713c 100644 --- a/platform/icons/src/nodes/treeRightArrow.png +++ b/platform/icons/src/nodes/treeRightArrow.png diff --git a/platform/icons/src/nodes/undeploy.png b/platform/icons/src/nodes/undeploy.png Binary files differindex 8aa42642fb0e..cf9cb1221f84 100644 --- a/platform/icons/src/nodes/undeploy.png +++ b/platform/icons/src/nodes/undeploy.png diff --git a/platform/icons/src/nodes/unknownJdk.png b/platform/icons/src/nodes/unknownJdk.png Binary files differindex 640beff29799..a0cd9974c0b9 100644 --- a/platform/icons/src/nodes/unknownJdk.png +++ b/platform/icons/src/nodes/unknownJdk.png diff --git a/platform/icons/src/nodes/upFolder.png b/platform/icons/src/nodes/upFolder.png Binary files differindex ae8b3e352be2..859969d3dc6f 100644 --- a/platform/icons/src/nodes/upFolder.png +++ b/platform/icons/src/nodes/upFolder.png diff --git a/platform/icons/src/nodes/upLevel.png b/platform/icons/src/nodes/upLevel.png Binary files differindex d7e4ee6fbc99..704406857f38 100644 --- a/platform/icons/src/nodes/upLevel.png +++ b/platform/icons/src/nodes/upLevel.png diff --git a/platform/icons/src/nodes/variable.png b/platform/icons/src/nodes/variable.png Binary files differindex 7312fe47d3b3..074107ae1882 100644 --- a/platform/icons/src/nodes/variable.png +++ b/platform/icons/src/nodes/variable.png diff --git a/platform/icons/src/nodes/warningIntroduction.png b/platform/icons/src/nodes/warningIntroduction.png Binary files differindex 15022d30ba45..48af6656908e 100644 --- a/platform/icons/src/nodes/warningIntroduction.png +++ b/platform/icons/src/nodes/warningIntroduction.png diff --git a/platform/icons/src/nodes/webFolder.png b/platform/icons/src/nodes/webFolder.png Binary files differindex 45034ec3da4f..6285deed2039 100644 --- a/platform/icons/src/nodes/webFolder.png +++ b/platform/icons/src/nodes/webFolder.png diff --git a/platform/icons/src/nodes/weblistener.png b/platform/icons/src/nodes/weblistener.png Binary files differindex 7d88c7b3c001..0836cdde914f 100644 --- a/platform/icons/src/nodes/weblistener.png +++ b/platform/icons/src/nodes/weblistener.png diff --git a/platform/icons/src/nodes/write-access.png b/platform/icons/src/nodes/write-access.png Binary files differindex f3fc46fdf6d2..da8cfc66a615 100644 --- a/platform/icons/src/nodes/write-access.png +++ b/platform/icons/src/nodes/write-access.png diff --git a/platform/icons/src/objectBrowser/abbreviatePackageNames.png b/platform/icons/src/objectBrowser/abbreviatePackageNames.png Binary files differindex c386ed4cfb6d..80b08c2947c5 100644 --- a/platform/icons/src/objectBrowser/abbreviatePackageNames.png +++ b/platform/icons/src/objectBrowser/abbreviatePackageNames.png diff --git a/platform/icons/src/objectBrowser/compactEmptyPackages.png b/platform/icons/src/objectBrowser/compactEmptyPackages.png Binary files differindex d4399254baa5..e5c921548bd2 100644 --- a/platform/icons/src/objectBrowser/compactEmptyPackages.png +++ b/platform/icons/src/objectBrowser/compactEmptyPackages.png diff --git a/platform/icons/src/objectBrowser/flattenPackages.png b/platform/icons/src/objectBrowser/flattenPackages.png Binary files differindex 69311433361c..42591fe6c4b5 100644 --- a/platform/icons/src/objectBrowser/flattenPackages.png +++ b/platform/icons/src/objectBrowser/flattenPackages.png diff --git a/platform/icons/src/objectBrowser/showEditorHighlighting.png b/platform/icons/src/objectBrowser/showEditorHighlighting.png Binary files differindex 614f7cadcf27..1ae19aac5856 100644 --- a/platform/icons/src/objectBrowser/showEditorHighlighting.png +++ b/platform/icons/src/objectBrowser/showEditorHighlighting.png diff --git a/platform/icons/src/objectBrowser/showLibraryContents.png b/platform/icons/src/objectBrowser/showLibraryContents.png Binary files differindex 19137fc211d2..5e2a69d0a728 100644 --- a/platform/icons/src/objectBrowser/showLibraryContents.png +++ b/platform/icons/src/objectBrowser/showLibraryContents.png diff --git a/platform/icons/src/objectBrowser/showMembers.png b/platform/icons/src/objectBrowser/showMembers.png Binary files differindex 7b23cbfb0667..6fa5bbfcd54f 100644 --- a/platform/icons/src/objectBrowser/showMembers.png +++ b/platform/icons/src/objectBrowser/showMembers.png diff --git a/platform/icons/src/objectBrowser/showModules.png b/platform/icons/src/objectBrowser/showModules.png Binary files differindex 86a6b55ec88c..0e3b650e0f68 100644 --- a/platform/icons/src/objectBrowser/showModules.png +++ b/platform/icons/src/objectBrowser/showModules.png diff --git a/platform/icons/src/objectBrowser/sortByType.png b/platform/icons/src/objectBrowser/sortByType.png Binary files differindex f24d04bed113..079167f79c0f 100644 --- a/platform/icons/src/objectBrowser/sortByType.png +++ b/platform/icons/src/objectBrowser/sortByType.png diff --git a/platform/icons/src/objectBrowser/sorted.png b/platform/icons/src/objectBrowser/sorted.png Binary files differindex 7c4cc0fa058e..5a3b847cdbc6 100644 --- a/platform/icons/src/objectBrowser/sorted.png +++ b/platform/icons/src/objectBrowser/sorted.png diff --git a/platform/icons/src/objectBrowser/sortedByUsage.png b/platform/icons/src/objectBrowser/sortedByUsage.png Binary files differindex 8419a834ed41..6cddc4121975 100644 --- a/platform/icons/src/objectBrowser/sortedByUsage.png +++ b/platform/icons/src/objectBrowser/sortedByUsage.png diff --git a/platform/icons/src/objectBrowser/visibilitySort.png b/platform/icons/src/objectBrowser/visibilitySort.png Binary files differindex ae624838ee2c..4cedbc462166 100644 --- a/platform/icons/src/objectBrowser/visibilitySort.png +++ b/platform/icons/src/objectBrowser/visibilitySort.png diff --git a/platform/icons/src/preferences/Appearance.png b/platform/icons/src/preferences/Appearance.png Binary files differindex 92ab55214701..007393e5e45c 100644 --- a/platform/icons/src/preferences/Appearance.png +++ b/platform/icons/src/preferences/Appearance.png diff --git a/platform/icons/src/preferences/CodeStyle.png b/platform/icons/src/preferences/CodeStyle.png Binary files differindex 221b86bf77e7..9816ec7877b0 100644 --- a/platform/icons/src/preferences/CodeStyle.png +++ b/platform/icons/src/preferences/CodeStyle.png diff --git a/platform/icons/src/preferences/Compiler.png b/platform/icons/src/preferences/Compiler.png Binary files differindex bb874820f140..e7e902c54c5c 100644 --- a/platform/icons/src/preferences/Compiler.png +++ b/platform/icons/src/preferences/Compiler.png diff --git a/platform/icons/src/preferences/Editor.png b/platform/icons/src/preferences/Editor.png Binary files differindex 3f9e668ebb93..2ba313300797 100644 --- a/platform/icons/src/preferences/Editor.png +++ b/platform/icons/src/preferences/Editor.png diff --git a/platform/icons/src/preferences/FileColors.png b/platform/icons/src/preferences/FileColors.png Binary files differindex d14bc0695da0..945610f56b06 100644 --- a/platform/icons/src/preferences/FileColors.png +++ b/platform/icons/src/preferences/FileColors.png diff --git a/platform/icons/src/preferences/FileTypes.png b/platform/icons/src/preferences/FileTypes.png Binary files differindex 8a3dd365f726..e5bf9fb7dd53 100644 --- a/platform/icons/src/preferences/FileTypes.png +++ b/platform/icons/src/preferences/FileTypes.png diff --git a/platform/icons/src/preferences/General.png b/platform/icons/src/preferences/General.png Binary files differindex e2e7f356ae16..686b8a9bca2a 100644 --- a/platform/icons/src/preferences/General.png +++ b/platform/icons/src/preferences/General.png diff --git a/platform/icons/src/preferences/Keymap.png b/platform/icons/src/preferences/Keymap.png Binary files differindex 9a7f011b917c..e3392321debc 100644 --- a/platform/icons/src/preferences/Keymap.png +++ b/platform/icons/src/preferences/Keymap.png diff --git a/platform/icons/src/preferences/Plugins.png b/platform/icons/src/preferences/Plugins.png Binary files differindex 5275a2a52da1..73f3c35f9429 100644 --- a/platform/icons/src/preferences/Plugins.png +++ b/platform/icons/src/preferences/Plugins.png diff --git a/platform/icons/src/preferences/VersionControl.png b/platform/icons/src/preferences/VersionControl.png Binary files differindex d404b40b6170..152da1448983 100644 --- a/platform/icons/src/preferences/VersionControl.png +++ b/platform/icons/src/preferences/VersionControl.png diff --git a/platform/icons/src/process/big/step_1.png b/platform/icons/src/process/big/step_1.png Binary files differindex e2e8bcb239b7..88c6582959cc 100644 --- a/platform/icons/src/process/big/step_1.png +++ b/platform/icons/src/process/big/step_1.png diff --git a/platform/icons/src/process/big/step_10.png b/platform/icons/src/process/big/step_10.png Binary files differindex e1046955de4e..2e0fd07cfdbf 100644 --- a/platform/icons/src/process/big/step_10.png +++ b/platform/icons/src/process/big/step_10.png diff --git a/platform/icons/src/process/big/step_11.png b/platform/icons/src/process/big/step_11.png Binary files differindex d1507391bdf5..51fbaba9e6b1 100644 --- a/platform/icons/src/process/big/step_11.png +++ b/platform/icons/src/process/big/step_11.png diff --git a/platform/icons/src/process/big/step_12.png b/platform/icons/src/process/big/step_12.png Binary files differindex f5dae29332a3..a08c24f01129 100644 --- a/platform/icons/src/process/big/step_12.png +++ b/platform/icons/src/process/big/step_12.png diff --git a/platform/icons/src/process/big/step_2.png b/platform/icons/src/process/big/step_2.png Binary files differindex 7ddd81f12e9b..e563d6c08d23 100644 --- a/platform/icons/src/process/big/step_2.png +++ b/platform/icons/src/process/big/step_2.png diff --git a/platform/icons/src/process/big/step_3.png b/platform/icons/src/process/big/step_3.png Binary files differindex a8ab76eada6b..7af5df327700 100644 --- a/platform/icons/src/process/big/step_3.png +++ b/platform/icons/src/process/big/step_3.png diff --git a/platform/icons/src/process/big/step_4.png b/platform/icons/src/process/big/step_4.png Binary files differindex e8abaaa51b7b..a9bb82a14896 100644 --- a/platform/icons/src/process/big/step_4.png +++ b/platform/icons/src/process/big/step_4.png diff --git a/platform/icons/src/process/big/step_5.png b/platform/icons/src/process/big/step_5.png Binary files differindex a31d58681c45..d471e39b09de 100644 --- a/platform/icons/src/process/big/step_5.png +++ b/platform/icons/src/process/big/step_5.png diff --git a/platform/icons/src/process/big/step_6.png b/platform/icons/src/process/big/step_6.png Binary files differindex de982dddff6a..022c6a5a102a 100644 --- a/platform/icons/src/process/big/step_6.png +++ b/platform/icons/src/process/big/step_6.png diff --git a/platform/icons/src/process/big/step_7.png b/platform/icons/src/process/big/step_7.png Binary files differindex 96f741b0e792..9896f8023e06 100644 --- a/platform/icons/src/process/big/step_7.png +++ b/platform/icons/src/process/big/step_7.png diff --git a/platform/icons/src/process/big/step_8.png b/platform/icons/src/process/big/step_8.png Binary files differindex 2f4faa50ff20..a3de8607f567 100644 --- a/platform/icons/src/process/big/step_8.png +++ b/platform/icons/src/process/big/step_8.png diff --git a/platform/icons/src/process/big/step_9.png b/platform/icons/src/process/big/step_9.png Binary files differindex c7a167466806..75c02731b6bb 100644 --- a/platform/icons/src/process/big/step_9.png +++ b/platform/icons/src/process/big/step_9.png diff --git a/platform/icons/src/process/big/step_passive.png b/platform/icons/src/process/big/step_passive.png Binary files differindex 84678dd7948b..49bd66ae8ca1 100644 --- a/platform/icons/src/process/big/step_passive.png +++ b/platform/icons/src/process/big/step_passive.png diff --git a/platform/icons/src/process/disabledDebug.png b/platform/icons/src/process/disabledDebug.png Binary files differindex c068f0cdda76..99dd37695b1b 100644 --- a/platform/icons/src/process/disabledDebug.png +++ b/platform/icons/src/process/disabledDebug.png diff --git a/platform/icons/src/process/disabledRun.png b/platform/icons/src/process/disabledRun.png Binary files differindex 7f6e3a25e99c..9feb49c02aad 100644 --- a/platform/icons/src/process/disabledRun.png +++ b/platform/icons/src/process/disabledRun.png diff --git a/platform/icons/src/process/fs/step_1.png b/platform/icons/src/process/fs/step_1.png Binary files differindex e7a306cf2d5a..1a71da19803a 100644 --- a/platform/icons/src/process/fs/step_1.png +++ b/platform/icons/src/process/fs/step_1.png diff --git a/platform/icons/src/process/fs/step_10.png b/platform/icons/src/process/fs/step_10.png Binary files differindex 63eba29de08e..ff776329ac21 100644 --- a/platform/icons/src/process/fs/step_10.png +++ b/platform/icons/src/process/fs/step_10.png diff --git a/platform/icons/src/process/fs/step_11.png b/platform/icons/src/process/fs/step_11.png Binary files differindex 81ee2ba37138..95689057dad4 100644 --- a/platform/icons/src/process/fs/step_11.png +++ b/platform/icons/src/process/fs/step_11.png diff --git a/platform/icons/src/process/fs/step_12.png b/platform/icons/src/process/fs/step_12.png Binary files differindex 678a19cb9816..3b5ac19b9c99 100644 --- a/platform/icons/src/process/fs/step_12.png +++ b/platform/icons/src/process/fs/step_12.png diff --git a/platform/icons/src/process/fs/step_13.png b/platform/icons/src/process/fs/step_13.png Binary files differindex eaab66e5eba6..159ff9da11cc 100644 --- a/platform/icons/src/process/fs/step_13.png +++ b/platform/icons/src/process/fs/step_13.png diff --git a/platform/icons/src/process/fs/step_14.png b/platform/icons/src/process/fs/step_14.png Binary files differindex 82b1fbbed3da..8f68467897c8 100644 --- a/platform/icons/src/process/fs/step_14.png +++ b/platform/icons/src/process/fs/step_14.png diff --git a/platform/icons/src/process/fs/step_15.png b/platform/icons/src/process/fs/step_15.png Binary files differindex 2f6212277fa3..28fcefac569f 100644 --- a/platform/icons/src/process/fs/step_15.png +++ b/platform/icons/src/process/fs/step_15.png diff --git a/platform/icons/src/process/fs/step_16.png b/platform/icons/src/process/fs/step_16.png Binary files differindex 3776e95165fe..d0d15781c063 100644 --- a/platform/icons/src/process/fs/step_16.png +++ b/platform/icons/src/process/fs/step_16.png diff --git a/platform/icons/src/process/fs/step_17.png b/platform/icons/src/process/fs/step_17.png Binary files differindex ecaed552cba4..2dff667ff728 100644 --- a/platform/icons/src/process/fs/step_17.png +++ b/platform/icons/src/process/fs/step_17.png diff --git a/platform/icons/src/process/fs/step_18.png b/platform/icons/src/process/fs/step_18.png Binary files differindex 90dd8179a111..523e1ca88cab 100644 --- a/platform/icons/src/process/fs/step_18.png +++ b/platform/icons/src/process/fs/step_18.png diff --git a/platform/icons/src/process/fs/step_2.png b/platform/icons/src/process/fs/step_2.png Binary files differindex 990e1af4f4cb..45252843d6f5 100644 --- a/platform/icons/src/process/fs/step_2.png +++ b/platform/icons/src/process/fs/step_2.png diff --git a/platform/icons/src/process/fs/step_3.png b/platform/icons/src/process/fs/step_3.png Binary files differindex 14327de049ed..61636685fde6 100644 --- a/platform/icons/src/process/fs/step_3.png +++ b/platform/icons/src/process/fs/step_3.png diff --git a/platform/icons/src/process/fs/step_4.png b/platform/icons/src/process/fs/step_4.png Binary files differindex 0ffc8ca54714..c8966de89c09 100644 --- a/platform/icons/src/process/fs/step_4.png +++ b/platform/icons/src/process/fs/step_4.png diff --git a/platform/icons/src/process/fs/step_5.png b/platform/icons/src/process/fs/step_5.png Binary files differindex 87749599f973..5faa92c4fd69 100644 --- a/platform/icons/src/process/fs/step_5.png +++ b/platform/icons/src/process/fs/step_5.png diff --git a/platform/icons/src/process/fs/step_6.png b/platform/icons/src/process/fs/step_6.png Binary files differindex a6a79945cf91..fa1f716b8d31 100644 --- a/platform/icons/src/process/fs/step_6.png +++ b/platform/icons/src/process/fs/step_6.png diff --git a/platform/icons/src/process/fs/step_7.png b/platform/icons/src/process/fs/step_7.png Binary files differindex 45e99c783043..31b69c269ecc 100644 --- a/platform/icons/src/process/fs/step_7.png +++ b/platform/icons/src/process/fs/step_7.png diff --git a/platform/icons/src/process/fs/step_8.png b/platform/icons/src/process/fs/step_8.png Binary files differindex ddeba8a159c6..c5e42764a931 100644 --- a/platform/icons/src/process/fs/step_8.png +++ b/platform/icons/src/process/fs/step_8.png diff --git a/platform/icons/src/process/fs/step_9.png b/platform/icons/src/process/fs/step_9.png Binary files differindex 26fcb83cbd2c..6988636c675b 100644 --- a/platform/icons/src/process/fs/step_9.png +++ b/platform/icons/src/process/fs/step_9.png diff --git a/platform/icons/src/process/fs/step_passive.png b/platform/icons/src/process/fs/step_passive.png Binary files differindex 0d4d19b3c94e..5b5192eb0144 100644 --- a/platform/icons/src/process/fs/step_passive.png +++ b/platform/icons/src/process/fs/step_passive.png diff --git a/platform/icons/src/process/step_1.png b/platform/icons/src/process/step_1.png Binary files differindex a6c768c067f2..7a14690a6159 100644 --- a/platform/icons/src/process/step_1.png +++ b/platform/icons/src/process/step_1.png diff --git a/platform/icons/src/process/step_10.png b/platform/icons/src/process/step_10.png Binary files differindex b0a7fa059524..effcda47b0bf 100644 --- a/platform/icons/src/process/step_10.png +++ b/platform/icons/src/process/step_10.png diff --git a/platform/icons/src/process/step_11.png b/platform/icons/src/process/step_11.png Binary files differindex 041e99e5ef0c..c6dd2afcaef0 100644 --- a/platform/icons/src/process/step_11.png +++ b/platform/icons/src/process/step_11.png diff --git a/platform/icons/src/process/step_12.png b/platform/icons/src/process/step_12.png Binary files differindex b2055611320a..7a50d3a7ed1b 100644 --- a/platform/icons/src/process/step_12.png +++ b/platform/icons/src/process/step_12.png diff --git a/platform/icons/src/process/step_2.png b/platform/icons/src/process/step_2.png Binary files differindex 5ebecb0eac28..b2d9362bb6de 100644 --- a/platform/icons/src/process/step_2.png +++ b/platform/icons/src/process/step_2.png diff --git a/platform/icons/src/process/step_3.png b/platform/icons/src/process/step_3.png Binary files differindex 48f2277d3e9b..d2cf93ae1471 100644 --- a/platform/icons/src/process/step_3.png +++ b/platform/icons/src/process/step_3.png diff --git a/platform/icons/src/process/step_4.png b/platform/icons/src/process/step_4.png Binary files differindex 5220ce379afb..f53ccee9b451 100644 --- a/platform/icons/src/process/step_4.png +++ b/platform/icons/src/process/step_4.png diff --git a/platform/icons/src/process/step_5.png b/platform/icons/src/process/step_5.png Binary files differindex 5d4b257bf30e..9221d14df9d8 100644 --- a/platform/icons/src/process/step_5.png +++ b/platform/icons/src/process/step_5.png diff --git a/platform/icons/src/process/step_6.png b/platform/icons/src/process/step_6.png Binary files differindex 5b93e83bfb12..fd05e316ba46 100644 --- a/platform/icons/src/process/step_6.png +++ b/platform/icons/src/process/step_6.png diff --git a/platform/icons/src/process/step_7.png b/platform/icons/src/process/step_7.png Binary files differindex 5737aae8c1ec..10f05c520fdc 100644 --- a/platform/icons/src/process/step_7.png +++ b/platform/icons/src/process/step_7.png diff --git a/platform/icons/src/process/step_8.png b/platform/icons/src/process/step_8.png Binary files differindex 909fe558080f..476d4dcdaf44 100644 --- a/platform/icons/src/process/step_8.png +++ b/platform/icons/src/process/step_8.png diff --git a/platform/icons/src/process/step_9.png b/platform/icons/src/process/step_9.png Binary files differindex 62c1a84a1e5a..5bf9b8f2ceb1 100644 --- a/platform/icons/src/process/step_9.png +++ b/platform/icons/src/process/step_9.png diff --git a/platform/icons/src/process/step_mask.png b/platform/icons/src/process/step_mask.png Binary files differindex 65e86be01857..45e0833f8612 100644 --- a/platform/icons/src/process/step_mask.png +++ b/platform/icons/src/process/step_mask.png diff --git a/platform/icons/src/process/step_passive.png b/platform/icons/src/process/step_passive.png Binary files differindex 8015851c00fc..5fc53271be48 100755 --- a/platform/icons/src/process/step_passive.png +++ b/platform/icons/src/process/step_passive.png diff --git a/platform/icons/src/process/stop.png b/platform/icons/src/process/stop.png Binary files differindex 238d9409d9ac..87622228a8ea 100644 --- a/platform/icons/src/process/stop.png +++ b/platform/icons/src/process/stop.png diff --git a/platform/icons/src/process/stopHovered.png b/platform/icons/src/process/stopHovered.png Binary files differindex 266f8c61d93b..420f2606e5e1 100644 --- a/platform/icons/src/process/stopHovered.png +++ b/platform/icons/src/process/stopHovered.png diff --git a/platform/icons/src/providers/apache.png b/platform/icons/src/providers/apache.png Binary files differindex c467a9fbd1f1..eccb5d88f71c 100644 --- a/platform/icons/src/providers/apache.png +++ b/platform/icons/src/providers/apache.png diff --git a/platform/icons/src/providers/cvs.png b/platform/icons/src/providers/cvs.png Binary files differindex 79800c5896d9..375036a89805 100644 --- a/platform/icons/src/providers/cvs.png +++ b/platform/icons/src/providers/cvs.png diff --git a/platform/icons/src/providers/eclipse.png b/platform/icons/src/providers/eclipse.png Binary files differindex bf32191663a5..ff3f9a87e5e7 100644 --- a/platform/icons/src/providers/eclipse.png +++ b/platform/icons/src/providers/eclipse.png diff --git a/platform/icons/src/providers/h2.png b/platform/icons/src/providers/h2.png Binary files differindex 3485508a6948..a494f7a5529a 100644 --- a/platform/icons/src/providers/h2.png +++ b/platform/icons/src/providers/h2.png diff --git a/platform/icons/src/providers/hibernate.png b/platform/icons/src/providers/hibernate.png Binary files differindex 111b950eae87..d15254305187 100644 --- a/platform/icons/src/providers/hibernate.png +++ b/platform/icons/src/providers/hibernate.png diff --git a/platform/icons/src/providers/hsqldb.png b/platform/icons/src/providers/hsqldb.png Binary files differindex 15229aa0e6f4..cf75da42c6d5 100644 --- a/platform/icons/src/providers/hsqldb.png +++ b/platform/icons/src/providers/hsqldb.png diff --git a/platform/icons/src/providers/ibm.png b/platform/icons/src/providers/ibm.png Binary files differindex 59c07cb42a08..baadbb0442e9 100644 --- a/platform/icons/src/providers/ibm.png +++ b/platform/icons/src/providers/ibm.png diff --git a/platform/icons/src/providers/microsoft.png b/platform/icons/src/providers/microsoft.png Binary files differindex 9405b7fe158a..e085fe288a68 100644 --- a/platform/icons/src/providers/microsoft.png +++ b/platform/icons/src/providers/microsoft.png diff --git a/platform/icons/src/providers/mysql.png b/platform/icons/src/providers/mysql.png Binary files differindex 87935397a168..47e911db51c9 100644 --- a/platform/icons/src/providers/mysql.png +++ b/platform/icons/src/providers/mysql.png diff --git a/platform/icons/src/providers/oracle.png b/platform/icons/src/providers/oracle.png Binary files differindex 40f5173d65ee..8858e1ef97fc 100644 --- a/platform/icons/src/providers/oracle.png +++ b/platform/icons/src/providers/oracle.png diff --git a/platform/icons/src/providers/postgresql.png b/platform/icons/src/providers/postgresql.png Binary files differindex 0025dd79264b..7b5875aebdab 100644 --- a/platform/icons/src/providers/postgresql.png +++ b/platform/icons/src/providers/postgresql.png diff --git a/platform/icons/src/providers/sqlite.png b/platform/icons/src/providers/sqlite.png Binary files differindex 467a574c1bb5..f6e521e3c9f8 100644 --- a/platform/icons/src/providers/sqlite.png +++ b/platform/icons/src/providers/sqlite.png diff --git a/platform/icons/src/providers/sun.png b/platform/icons/src/providers/sun.png Binary files differindex aa457d546cad..e82004832b54 100644 --- a/platform/icons/src/providers/sun.png +++ b/platform/icons/src/providers/sun.png diff --git a/platform/icons/src/providers/sybase.png b/platform/icons/src/providers/sybase.png Binary files differindex d2f0509f2004..50142f8b6358 100644 --- a/platform/icons/src/providers/sybase.png +++ b/platform/icons/src/providers/sybase.png diff --git a/platform/icons/src/runConfigurations/applet.png b/platform/icons/src/runConfigurations/applet.png Binary files differindex f28a417be400..8e6930ead88f 100644 --- a/platform/icons/src/runConfigurations/applet.png +++ b/platform/icons/src/runConfigurations/applet.png diff --git a/platform/icons/src/runConfigurations/application.png b/platform/icons/src/runConfigurations/application.png Binary files differindex 45e4df801ca0..3a727e6c68b9 100644 --- a/platform/icons/src/runConfigurations/application.png +++ b/platform/icons/src/runConfigurations/application.png diff --git a/platform/icons/src/runConfigurations/configurationWarning.png b/platform/icons/src/runConfigurations/configurationWarning.png Binary files differindex c4d38cf71e5b..fcbd9f0e1464 100644 --- a/platform/icons/src/runConfigurations/configurationWarning.png +++ b/platform/icons/src/runConfigurations/configurationWarning.png diff --git a/platform/icons/src/runConfigurations/hidePassed.png b/platform/icons/src/runConfigurations/hidePassed.png Binary files differindex 6945424e5f3a..a415f995ec33 100644 --- a/platform/icons/src/runConfigurations/hidePassed.png +++ b/platform/icons/src/runConfigurations/hidePassed.png diff --git a/platform/icons/src/runConfigurations/ignoredTest.png b/platform/icons/src/runConfigurations/ignoredTest.png Binary files differindex 4a3b4841e6ca..28af53e2bd6d 100644 --- a/platform/icons/src/runConfigurations/ignoredTest.png +++ b/platform/icons/src/runConfigurations/ignoredTest.png diff --git a/platform/icons/src/runConfigurations/invalidConfigurationLayer.png b/platform/icons/src/runConfigurations/invalidConfigurationLayer.png Binary files differindex 25f27bcf4dce..a1a3c39bbf5e 100644 --- a/platform/icons/src/runConfigurations/invalidConfigurationLayer.png +++ b/platform/icons/src/runConfigurations/invalidConfigurationLayer.png diff --git a/platform/icons/src/runConfigurations/junit.png b/platform/icons/src/runConfigurations/junit.png Binary files differindex 5c3994de9d2a..80baa67446e4 100644 --- a/platform/icons/src/runConfigurations/junit.png +++ b/platform/icons/src/runConfigurations/junit.png diff --git a/platform/icons/src/runConfigurations/loadingTree.png b/platform/icons/src/runConfigurations/loadingTree.png Binary files differindex f8b18a0edaf0..c3c5df94d43a 100644 --- a/platform/icons/src/runConfigurations/loadingTree.png +++ b/platform/icons/src/runConfigurations/loadingTree.png diff --git a/platform/icons/src/runConfigurations/ql_console.png b/platform/icons/src/runConfigurations/ql_console.png Binary files differindex bd2112cff706..95e6de90c71c 100644 --- a/platform/icons/src/runConfigurations/ql_console.png +++ b/platform/icons/src/runConfigurations/ql_console.png diff --git a/platform/icons/src/runConfigurations/remote.png b/platform/icons/src/runConfigurations/remote.png Binary files differindex da89af51b216..4190abe77a58 100644 --- a/platform/icons/src/runConfigurations/remote.png +++ b/platform/icons/src/runConfigurations/remote.png diff --git a/platform/icons/src/runConfigurations/rerunFailedTests.png b/platform/icons/src/runConfigurations/rerunFailedTests.png Binary files differindex 6c96b3f8d1c1..7e176188f502 100644 --- a/platform/icons/src/runConfigurations/rerunFailedTests.png +++ b/platform/icons/src/runConfigurations/rerunFailedTests.png diff --git a/platform/icons/src/runConfigurations/saveTempConfig.png b/platform/icons/src/runConfigurations/saveTempConfig.png Binary files differindex 9d7861c720d3..40edbf158772 100644 --- a/platform/icons/src/runConfigurations/saveTempConfig.png +++ b/platform/icons/src/runConfigurations/saveTempConfig.png diff --git a/platform/icons/src/runConfigurations/scrollToStackTrace.png b/platform/icons/src/runConfigurations/scrollToStackTrace.png Binary files differindex 3a28a3df77f5..cd945386652b 100644 --- a/platform/icons/src/runConfigurations/scrollToStackTrace.png +++ b/platform/icons/src/runConfigurations/scrollToStackTrace.png diff --git a/platform/icons/src/runConfigurations/scroll_down.png b/platform/icons/src/runConfigurations/scroll_down.png Binary files differindex 61d1a668b0d5..b50ade5959ab 100644 --- a/platform/icons/src/runConfigurations/scroll_down.png +++ b/platform/icons/src/runConfigurations/scroll_down.png diff --git a/platform/icons/src/runConfigurations/selectFirstDefect.png b/platform/icons/src/runConfigurations/selectFirstDefect.png Binary files differindex b8d54a9db8b2..4b3d1934badf 100644 --- a/platform/icons/src/runConfigurations/selectFirstDefect.png +++ b/platform/icons/src/runConfigurations/selectFirstDefect.png diff --git a/platform/icons/src/runConfigurations/sourceAtException.png b/platform/icons/src/runConfigurations/sourceAtException.png Binary files differindex f16c6730c8a5..f604b87eb7ae 100644 --- a/platform/icons/src/runConfigurations/sourceAtException.png +++ b/platform/icons/src/runConfigurations/sourceAtException.png diff --git a/platform/icons/src/runConfigurations/testError.png b/platform/icons/src/runConfigurations/testError.png Binary files differindex c4d38cf71e5b..fcbd9f0e1464 100644 --- a/platform/icons/src/runConfigurations/testError.png +++ b/platform/icons/src/runConfigurations/testError.png diff --git a/platform/icons/src/runConfigurations/testFailed.png b/platform/icons/src/runConfigurations/testFailed.png Binary files differindex 1a88b3f0e629..30de584ed903 100644 --- a/platform/icons/src/runConfigurations/testFailed.png +++ b/platform/icons/src/runConfigurations/testFailed.png diff --git a/platform/icons/src/runConfigurations/testIgnored.png b/platform/icons/src/runConfigurations/testIgnored.png Binary files differindex c2f80f331b54..0dcae200f0fb 100644 --- a/platform/icons/src/runConfigurations/testIgnored.png +++ b/platform/icons/src/runConfigurations/testIgnored.png diff --git a/platform/icons/src/runConfigurations/testInProgress1.png b/platform/icons/src/runConfigurations/testInProgress1.png Binary files differindex 97cf132ad643..e7d186b4cc4a 100644 --- a/platform/icons/src/runConfigurations/testInProgress1.png +++ b/platform/icons/src/runConfigurations/testInProgress1.png diff --git a/platform/icons/src/runConfigurations/testInProgress2.png b/platform/icons/src/runConfigurations/testInProgress2.png Binary files differindex ccd7d83c2847..42bcd5dd935f 100644 --- a/platform/icons/src/runConfigurations/testInProgress2.png +++ b/platform/icons/src/runConfigurations/testInProgress2.png diff --git a/platform/icons/src/runConfigurations/testInProgress3.png b/platform/icons/src/runConfigurations/testInProgress3.png Binary files differindex 583cf6bf9d5e..c35782eda9ff 100644 --- a/platform/icons/src/runConfigurations/testInProgress3.png +++ b/platform/icons/src/runConfigurations/testInProgress3.png diff --git a/platform/icons/src/runConfigurations/testInProgress4.png b/platform/icons/src/runConfigurations/testInProgress4.png Binary files differindex 672e7ad98c07..d2e73e29481b 100644 --- a/platform/icons/src/runConfigurations/testInProgress4.png +++ b/platform/icons/src/runConfigurations/testInProgress4.png diff --git a/platform/icons/src/runConfigurations/testInProgress5.png b/platform/icons/src/runConfigurations/testInProgress5.png Binary files differindex 852802b2134e..3e6b6b378b2b 100644 --- a/platform/icons/src/runConfigurations/testInProgress5.png +++ b/platform/icons/src/runConfigurations/testInProgress5.png diff --git a/platform/icons/src/runConfigurations/testInProgress6.png b/platform/icons/src/runConfigurations/testInProgress6.png Binary files differindex a2675b6b04de..c6f09333b604 100644 --- a/platform/icons/src/runConfigurations/testInProgress6.png +++ b/platform/icons/src/runConfigurations/testInProgress6.png diff --git a/platform/icons/src/runConfigurations/testInProgress7.png b/platform/icons/src/runConfigurations/testInProgress7.png Binary files differindex 55eedfa49b04..e86dc992ae50 100644 --- a/platform/icons/src/runConfigurations/testInProgress7.png +++ b/platform/icons/src/runConfigurations/testInProgress7.png diff --git a/platform/icons/src/runConfigurations/testInProgress8.png b/platform/icons/src/runConfigurations/testInProgress8.png Binary files differindex df02d5325159..a7c2f48ae8e7 100644 --- a/platform/icons/src/runConfigurations/testInProgress8.png +++ b/platform/icons/src/runConfigurations/testInProgress8.png diff --git a/platform/icons/src/runConfigurations/testMark.png b/platform/icons/src/runConfigurations/testMark.png Binary files differindex 6a5fb237645c..653fcd79802b 100644 --- a/platform/icons/src/runConfigurations/testMark.png +++ b/platform/icons/src/runConfigurations/testMark.png diff --git a/platform/icons/src/runConfigurations/testNotRan.png b/platform/icons/src/runConfigurations/testNotRan.png Binary files differindex 83dde1c6b504..db2e5daf159a 100644 --- a/platform/icons/src/runConfigurations/testNotRan.png +++ b/platform/icons/src/runConfigurations/testNotRan.png diff --git a/platform/icons/src/runConfigurations/testPassed.png b/platform/icons/src/runConfigurations/testPassed.png Binary files differindex 9e226159c71a..72e8c654e7ff 100644 --- a/platform/icons/src/runConfigurations/testPassed.png +++ b/platform/icons/src/runConfigurations/testPassed.png diff --git a/platform/icons/src/runConfigurations/testPaused.png b/platform/icons/src/runConfigurations/testPaused.png Binary files differindex 555993ff2b72..bcdd65deea01 100644 --- a/platform/icons/src/runConfigurations/testPaused.png +++ b/platform/icons/src/runConfigurations/testPaused.png diff --git a/platform/icons/src/runConfigurations/testSkipped.png b/platform/icons/src/runConfigurations/testSkipped.png Binary files differindex ead70f31d369..0357d8c29d6c 100644 --- a/platform/icons/src/runConfigurations/testSkipped.png +++ b/platform/icons/src/runConfigurations/testSkipped.png diff --git a/platform/icons/src/runConfigurations/testTerminated.png b/platform/icons/src/runConfigurations/testTerminated.png Binary files differindex ca0a8bc41da2..7ce5175440d6 100644 --- a/platform/icons/src/runConfigurations/testTerminated.png +++ b/platform/icons/src/runConfigurations/testTerminated.png diff --git a/platform/icons/src/runConfigurations/tomcat.png b/platform/icons/src/runConfigurations/tomcat.png Binary files differindex d7faa64b9a95..d99642861f8e 100644 --- a/platform/icons/src/runConfigurations/tomcat.png +++ b/platform/icons/src/runConfigurations/tomcat.png diff --git a/platform/icons/src/runConfigurations/trackCoverage.png b/platform/icons/src/runConfigurations/trackCoverage.png Binary files differindex 88f69fde1b47..937383bbe2cf 100644 --- a/platform/icons/src/runConfigurations/trackCoverage.png +++ b/platform/icons/src/runConfigurations/trackCoverage.png diff --git a/platform/icons/src/runConfigurations/trackTests.png b/platform/icons/src/runConfigurations/trackTests.png Binary files differindex 8491df607e38..51bb1b13fd68 100644 --- a/platform/icons/src/runConfigurations/trackTests.png +++ b/platform/icons/src/runConfigurations/trackTests.png diff --git a/platform/icons/src/runConfigurations/unknown.png b/platform/icons/src/runConfigurations/unknown.png Binary files differindex aa2ae81f90f3..78bba0f84c20 100644 --- a/platform/icons/src/runConfigurations/unknown.png +++ b/platform/icons/src/runConfigurations/unknown.png diff --git a/platform/icons/src/runConfigurations/variables.png b/platform/icons/src/runConfigurations/variables.png Binary files differindex bcfa60b96c24..5e7471653b96 100644 --- a/platform/icons/src/runConfigurations/variables.png +++ b/platform/icons/src/runConfigurations/variables.png diff --git a/platform/icons/src/runConfigurations/web_app.png b/platform/icons/src/runConfigurations/web_app.png Binary files differindex b7d48716d6a7..fc981e884cd8 100644 --- a/platform/icons/src/runConfigurations/web_app.png +++ b/platform/icons/src/runConfigurations/web_app.png diff --git a/platform/icons/src/runConfigurations/withCoverageLayer.png b/platform/icons/src/runConfigurations/withCoverageLayer.png Binary files differindex 2f52828285b9..56d3b66efc91 100644 --- a/platform/icons/src/runConfigurations/withCoverageLayer.png +++ b/platform/icons/src/runConfigurations/withCoverageLayer.png diff --git a/platform/icons/src/toolbar/filterdups.png b/platform/icons/src/toolbar/filterdups.png Binary files differindex 648abe9cc052..f3a3dcfe5fbe 100644 --- a/platform/icons/src/toolbar/filterdups.png +++ b/platform/icons/src/toolbar/filterdups.png diff --git a/platform/icons/src/toolbar/folders.png b/platform/icons/src/toolbar/folders.png Binary files differindex 5bb3981cf3c2..deaa36ad4637 100644 --- a/platform/icons/src/toolbar/folders.png +++ b/platform/icons/src/toolbar/folders.png diff --git a/platform/icons/src/toolbar/unknown.png b/platform/icons/src/toolbar/unknown.png Binary files differindex 000da55025d1..cff8ba934dbf 100644 --- a/platform/icons/src/toolbar/unknown.png +++ b/platform/icons/src/toolbar/unknown.png diff --git a/platform/icons/src/toolbarDecorator/add.png b/platform/icons/src/toolbarDecorator/add.png Binary files differindex 13582dfe43e8..56e36aa9fd83 100644 --- a/platform/icons/src/toolbarDecorator/add.png +++ b/platform/icons/src/toolbarDecorator/add.png diff --git a/platform/icons/src/toolbarDecorator/addBlankLine.png b/platform/icons/src/toolbarDecorator/addBlankLine.png Binary files differindex eeb16f404d14..60abcc1201bc 100644 --- a/platform/icons/src/toolbarDecorator/addBlankLine.png +++ b/platform/icons/src/toolbarDecorator/addBlankLine.png diff --git a/platform/icons/src/toolbarDecorator/addClass.png b/platform/icons/src/toolbarDecorator/addClass.png Binary files differindex ef32f7a8a2cc..3654998bbbe1 100644 --- a/platform/icons/src/toolbarDecorator/addClass.png +++ b/platform/icons/src/toolbarDecorator/addClass.png diff --git a/platform/icons/src/toolbarDecorator/addFolder.png b/platform/icons/src/toolbarDecorator/addFolder.png Binary files differindex b59649852892..065e38451dc8 100644 --- a/platform/icons/src/toolbarDecorator/addFolder.png +++ b/platform/icons/src/toolbarDecorator/addFolder.png diff --git a/platform/icons/src/toolbarDecorator/addIcon.png b/platform/icons/src/toolbarDecorator/addIcon.png Binary files differindex 96f2a6dffe78..0cf5415c5f8d 100644 --- a/platform/icons/src/toolbarDecorator/addIcon.png +++ b/platform/icons/src/toolbarDecorator/addIcon.png diff --git a/platform/icons/src/toolbarDecorator/addJira.png b/platform/icons/src/toolbarDecorator/addJira.png Binary files differindex b3580eca766f..d334b193527c 100644 --- a/platform/icons/src/toolbarDecorator/addJira.png +++ b/platform/icons/src/toolbarDecorator/addJira.png diff --git a/platform/icons/src/toolbarDecorator/addLink.png b/platform/icons/src/toolbarDecorator/addLink.png Binary files differindex 9ed61dede5fd..ff697d288d5b 100644 --- a/platform/icons/src/toolbarDecorator/addLink.png +++ b/platform/icons/src/toolbarDecorator/addLink.png diff --git a/platform/icons/src/toolbarDecorator/addPackage.png b/platform/icons/src/toolbarDecorator/addPackage.png Binary files differindex 2f2e943c5721..4c7820ead767 100644 --- a/platform/icons/src/toolbarDecorator/addPackage.png +++ b/platform/icons/src/toolbarDecorator/addPackage.png diff --git a/platform/icons/src/toolbarDecorator/addPattern.png b/platform/icons/src/toolbarDecorator/addPattern.png Binary files differindex 4568d46b4bbe..a45350a8afef 100644 --- a/platform/icons/src/toolbarDecorator/addPattern.png +++ b/platform/icons/src/toolbarDecorator/addPattern.png diff --git a/platform/icons/src/toolbarDecorator/addRemoteDatasource.png b/platform/icons/src/toolbarDecorator/addRemoteDatasource.png Binary files differindex c48f030ecbed..394f46e74e28 100644 --- a/platform/icons/src/toolbarDecorator/addRemoteDatasource.png +++ b/platform/icons/src/toolbarDecorator/addRemoteDatasource.png diff --git a/platform/icons/src/toolbarDecorator/addYouTrack.png b/platform/icons/src/toolbarDecorator/addYouTrack.png Binary files differindex 02b147baf48c..7a41b6497342 100644 --- a/platform/icons/src/toolbarDecorator/addYouTrack.png +++ b/platform/icons/src/toolbarDecorator/addYouTrack.png diff --git a/platform/icons/src/toolbarDecorator/analyze.png b/platform/icons/src/toolbarDecorator/analyze.png Binary files differindex b7ff182896f3..6dd48f2efe54 100644 --- a/platform/icons/src/toolbarDecorator/analyze.png +++ b/platform/icons/src/toolbarDecorator/analyze.png diff --git a/platform/icons/src/toolbarDecorator/edit.png b/platform/icons/src/toolbarDecorator/edit.png Binary files differindex c15765039ac7..5506d35a0ce1 100644 --- a/platform/icons/src/toolbarDecorator/edit.png +++ b/platform/icons/src/toolbarDecorator/edit.png diff --git a/platform/icons/src/toolbarDecorator/export.png b/platform/icons/src/toolbarDecorator/export.png Binary files differindex 0d527e423c27..791c268f8eee 100644 --- a/platform/icons/src/toolbarDecorator/export.png +++ b/platform/icons/src/toolbarDecorator/export.png diff --git a/platform/icons/src/toolbarDecorator/import.png b/platform/icons/src/toolbarDecorator/import.png Binary files differindex 420e84770b91..3d9845988e73 100644 --- a/platform/icons/src/toolbarDecorator/import.png +++ b/platform/icons/src/toolbarDecorator/import.png diff --git a/platform/icons/src/toolbarDecorator/mac/addBlankLine.png b/platform/icons/src/toolbarDecorator/mac/addBlankLine.png Binary files differindex 445e46ca34cf..01ca93ab4b60 100644 --- a/platform/icons/src/toolbarDecorator/mac/addBlankLine.png +++ b/platform/icons/src/toolbarDecorator/mac/addBlankLine.png diff --git a/platform/icons/src/toolbarDecorator/mac/addClass.png b/platform/icons/src/toolbarDecorator/mac/addClass.png Binary files differindex 9d914455cefa..e46a0851b3a1 100644 --- a/platform/icons/src/toolbarDecorator/mac/addClass.png +++ b/platform/icons/src/toolbarDecorator/mac/addClass.png diff --git a/platform/icons/src/toolbarDecorator/mac/addFolder.png b/platform/icons/src/toolbarDecorator/mac/addFolder.png Binary files differindex 1d3df98a61f9..78e84e26a0cb 100644 --- a/platform/icons/src/toolbarDecorator/mac/addFolder.png +++ b/platform/icons/src/toolbarDecorator/mac/addFolder.png diff --git a/platform/icons/src/toolbarDecorator/mac/addIcon.png b/platform/icons/src/toolbarDecorator/mac/addIcon.png Binary files differindex 68704cde1cfc..fd3b986ce5f0 100644 --- a/platform/icons/src/toolbarDecorator/mac/addIcon.png +++ b/platform/icons/src/toolbarDecorator/mac/addIcon.png diff --git a/platform/icons/src/toolbarDecorator/mac/addJira.png b/platform/icons/src/toolbarDecorator/mac/addJira.png Binary files differindex 3a99f5e51b92..4307afdf81fb 100644 --- a/platform/icons/src/toolbarDecorator/mac/addJira.png +++ b/platform/icons/src/toolbarDecorator/mac/addJira.png diff --git a/platform/icons/src/toolbarDecorator/mac/addLink.png b/platform/icons/src/toolbarDecorator/mac/addLink.png Binary files differindex da6929cf254d..7b83821222dd 100644 --- a/platform/icons/src/toolbarDecorator/mac/addLink.png +++ b/platform/icons/src/toolbarDecorator/mac/addLink.png diff --git a/platform/icons/src/toolbarDecorator/mac/addPackage.png b/platform/icons/src/toolbarDecorator/mac/addPackage.png Binary files differindex 5528ad257ea8..fee59310e077 100644 --- a/platform/icons/src/toolbarDecorator/mac/addPackage.png +++ b/platform/icons/src/toolbarDecorator/mac/addPackage.png diff --git a/platform/icons/src/toolbarDecorator/mac/addPattern.png b/platform/icons/src/toolbarDecorator/mac/addPattern.png Binary files differindex fc15e16dba75..7af660fea3dc 100644 --- a/platform/icons/src/toolbarDecorator/mac/addPattern.png +++ b/platform/icons/src/toolbarDecorator/mac/addPattern.png diff --git a/platform/icons/src/toolbarDecorator/mac/addRemoteDatasource.png b/platform/icons/src/toolbarDecorator/mac/addRemoteDatasource.png Binary files differindex bcdc4014c93d..666922e5ade1 100644 --- a/platform/icons/src/toolbarDecorator/mac/addRemoteDatasource.png +++ b/platform/icons/src/toolbarDecorator/mac/addRemoteDatasource.png diff --git a/platform/icons/src/toolbarDecorator/mac/addYouTrack.png b/platform/icons/src/toolbarDecorator/mac/addYouTrack.png Binary files differindex 53e9aaaedd69..8eb598997168 100644 --- a/platform/icons/src/toolbarDecorator/mac/addYouTrack.png +++ b/platform/icons/src/toolbarDecorator/mac/addYouTrack.png diff --git a/platform/icons/src/toolbarDecorator/mac/edit.png b/platform/icons/src/toolbarDecorator/mac/edit.png Binary files differindex fc34cad75154..055632301498 100644 --- a/platform/icons/src/toolbarDecorator/mac/edit.png +++ b/platform/icons/src/toolbarDecorator/mac/edit.png diff --git a/platform/icons/src/toolbarDecorator/moveDown.png b/platform/icons/src/toolbarDecorator/moveDown.png Binary files differindex 0b398dd7e8fa..2380fb5e4555 100644 --- a/platform/icons/src/toolbarDecorator/moveDown.png +++ b/platform/icons/src/toolbarDecorator/moveDown.png diff --git a/platform/icons/src/toolbarDecorator/moveUp.png b/platform/icons/src/toolbarDecorator/moveUp.png Binary files differindex ce4ec6b38cce..4795103cd98c 100644 --- a/platform/icons/src/toolbarDecorator/moveUp.png +++ b/platform/icons/src/toolbarDecorator/moveUp.png diff --git a/platform/icons/src/toolbarDecorator/remove.png b/platform/icons/src/toolbarDecorator/remove.png Binary files differindex 4a6ce012324a..32644b6d31cb 100644 --- a/platform/icons/src/toolbarDecorator/remove.png +++ b/platform/icons/src/toolbarDecorator/remove.png diff --git a/platform/icons/src/toolwindows/documentation.png b/platform/icons/src/toolwindows/documentation.png Binary files differindex 991567421636..a161f9eca90d 100644 --- a/platform/icons/src/toolwindows/documentation.png +++ b/platform/icons/src/toolwindows/documentation.png diff --git a/platform/icons/src/toolwindows/problems.png b/platform/icons/src/toolwindows/problems.png Binary files differindex fb9e455d4d48..a9d9d5a78580 100644 --- a/platform/icons/src/toolwindows/problems.png +++ b/platform/icons/src/toolwindows/problems.png diff --git a/platform/icons/src/toolwindows/toolWindowAnt.png b/platform/icons/src/toolwindows/toolWindowAnt.png Binary files differindex 5e90dcf9603f..83c0243d1b16 100644 --- a/platform/icons/src/toolwindows/toolWindowAnt.png +++ b/platform/icons/src/toolwindows/toolWindowAnt.png diff --git a/platform/icons/src/toolwindows/toolWindowChanges.png b/platform/icons/src/toolwindows/toolWindowChanges.png Binary files differindex 00f85424e100..fa690b75af53 100644 --- a/platform/icons/src/toolwindows/toolWindowChanges.png +++ b/platform/icons/src/toolwindows/toolWindowChanges.png diff --git a/platform/icons/src/toolwindows/toolWindowCommander.png b/platform/icons/src/toolwindows/toolWindowCommander.png Binary files differindex bd3224284369..c1ed52a38c3c 100644 --- a/platform/icons/src/toolwindows/toolWindowCommander.png +++ b/platform/icons/src/toolwindows/toolWindowCommander.png diff --git a/platform/icons/src/toolwindows/toolWindowCoverage.png b/platform/icons/src/toolwindows/toolWindowCoverage.png Binary files differindex 9bdb82bde474..5f9c723d3360 100644 --- a/platform/icons/src/toolwindows/toolWindowCoverage.png +++ b/platform/icons/src/toolwindows/toolWindowCoverage.png diff --git a/platform/icons/src/toolwindows/toolWindowCvs.png b/platform/icons/src/toolwindows/toolWindowCvs.png Binary files differindex 61784dbd8bb8..04b695c1a75d 100644 --- a/platform/icons/src/toolwindows/toolWindowCvs.png +++ b/platform/icons/src/toolwindows/toolWindowCvs.png diff --git a/platform/icons/src/toolwindows/toolWindowDebugger.png b/platform/icons/src/toolwindows/toolWindowDebugger.png Binary files differindex 840322eac453..c4fc9a66a1d9 100644 --- a/platform/icons/src/toolwindows/toolWindowDebugger.png +++ b/platform/icons/src/toolwindows/toolWindowDebugger.png diff --git a/platform/icons/src/toolwindows/toolWindowFavorites.png b/platform/icons/src/toolwindows/toolWindowFavorites.png Binary files differindex 8cf732221205..ecb9916cb639 100644 --- a/platform/icons/src/toolwindows/toolWindowFavorites.png +++ b/platform/icons/src/toolwindows/toolWindowFavorites.png diff --git a/platform/icons/src/toolwindows/toolWindowFind.png b/platform/icons/src/toolwindows/toolWindowFind.png Binary files differindex ead779e38f85..f7c3fc2197e1 100644 --- a/platform/icons/src/toolwindows/toolWindowFind.png +++ b/platform/icons/src/toolwindows/toolWindowFind.png diff --git a/platform/icons/src/toolwindows/toolWindowHierarchy.png b/platform/icons/src/toolwindows/toolWindowHierarchy.png Binary files differindex 8b69907b33a1..cc9b35614639 100644 --- a/platform/icons/src/toolwindows/toolWindowHierarchy.png +++ b/platform/icons/src/toolwindows/toolWindowHierarchy.png diff --git a/platform/icons/src/toolwindows/toolWindowInspection.png b/platform/icons/src/toolwindows/toolWindowInspection.png Binary files differindex 176e8986e43f..11cd96bf2347 100644 --- a/platform/icons/src/toolwindows/toolWindowInspection.png +++ b/platform/icons/src/toolwindows/toolWindowInspection.png diff --git a/platform/icons/src/toolwindows/toolWindowMessages.png b/platform/icons/src/toolwindows/toolWindowMessages.png Binary files differindex 19e881e1950a..36ed9b56ba7e 100644 --- a/platform/icons/src/toolwindows/toolWindowMessages.png +++ b/platform/icons/src/toolwindows/toolWindowMessages.png diff --git a/platform/icons/src/toolwindows/toolWindowModuleDependencies.png b/platform/icons/src/toolwindows/toolWindowModuleDependencies.png Binary files differindex 25797d493c2e..caa320fc7289 100644 --- a/platform/icons/src/toolwindows/toolWindowModuleDependencies.png +++ b/platform/icons/src/toolwindows/toolWindowModuleDependencies.png diff --git a/platform/icons/src/toolwindows/toolWindowPalette.png b/platform/icons/src/toolwindows/toolWindowPalette.png Binary files differindex 5c070d04b1d4..323a9723f1d5 100644 --- a/platform/icons/src/toolwindows/toolWindowPalette.png +++ b/platform/icons/src/toolwindows/toolWindowPalette.png diff --git a/platform/icons/src/toolwindows/toolWindowProject.png b/platform/icons/src/toolwindows/toolWindowProject.png Binary files differindex 2594d36707c2..97d9fd008ab8 100644 --- a/platform/icons/src/toolwindows/toolWindowProject.png +++ b/platform/icons/src/toolwindows/toolWindowProject.png diff --git a/platform/icons/src/toolwindows/toolWindowRun.png b/platform/icons/src/toolwindows/toolWindowRun.png Binary files differindex 18881d40ca56..843a76b49c69 100644 --- a/platform/icons/src/toolwindows/toolWindowRun.png +++ b/platform/icons/src/toolwindows/toolWindowRun.png diff --git a/platform/icons/src/toolwindows/toolWindowStructure.png b/platform/icons/src/toolwindows/toolWindowStructure.png Binary files differindex 2e24bdead137..7e9fb4b027b5 100644 --- a/platform/icons/src/toolwindows/toolWindowStructure.png +++ b/platform/icons/src/toolwindows/toolWindowStructure.png diff --git a/platform/icons/src/toolwindows/toolWindowTodo.png b/platform/icons/src/toolwindows/toolWindowTodo.png Binary files differindex 17ee3f3d5c4c..1e93e4bc0824 100644 --- a/platform/icons/src/toolwindows/toolWindowTodo.png +++ b/platform/icons/src/toolwindows/toolWindowTodo.png diff --git a/platform/icons/src/toolwindows/vcsSmallTab.png b/platform/icons/src/toolwindows/vcsSmallTab.png Binary files differindex 7de095db0ff8..5011b1f6451e 100644 --- a/platform/icons/src/toolwindows/vcsSmallTab.png +++ b/platform/icons/src/toolwindows/vcsSmallTab.png diff --git a/platform/icons/src/toolwindows/webToolWindow.png b/platform/icons/src/toolwindows/webToolWindow.png Binary files differindex ee75ef61b813..c3e2281f45cf 100644 --- a/platform/icons/src/toolwindows/webToolWindow.png +++ b/platform/icons/src/toolwindows/webToolWindow.png diff --git a/platform/icons/src/vcs/allRevisions.png b/platform/icons/src/vcs/allRevisions.png Binary files differindex b3572a45b317..31b05446b772 100644 --- a/platform/icons/src/vcs/allRevisions.png +++ b/platform/icons/src/vcs/allRevisions.png diff --git a/platform/icons/src/vcs/arrow_left.png b/platform/icons/src/vcs/arrow_left.png Binary files differindex 220ec70d51f3..81a180fa416a 100644 --- a/platform/icons/src/vcs/arrow_left.png +++ b/platform/icons/src/vcs/arrow_left.png diff --git a/platform/icons/src/vcs/arrow_right.png b/platform/icons/src/vcs/arrow_right.png Binary files differindex cf182909fb51..7d487c22f3d8 100644 --- a/platform/icons/src/vcs/arrow_right.png +++ b/platform/icons/src/vcs/arrow_right.png diff --git a/platform/icons/src/vcs/checkSpelling.png b/platform/icons/src/vcs/checkSpelling.png Binary files differindex b4977fb506fd..a9e8d5b61a31 100644 --- a/platform/icons/src/vcs/checkSpelling.png +++ b/platform/icons/src/vcs/checkSpelling.png diff --git a/platform/icons/src/vcs/equal.png b/platform/icons/src/vcs/equal.png Binary files differindex c9b5aae892ef..e137fa85b3e3 100644 --- a/platform/icons/src/vcs/equal.png +++ b/platform/icons/src/vcs/equal.png diff --git a/platform/icons/src/vcs/history.png b/platform/icons/src/vcs/history.png Binary files differindex a73b4e7d4055..289ee45589c9 100644 --- a/platform/icons/src/vcs/history.png +++ b/platform/icons/src/vcs/history.png diff --git a/platform/icons/src/vcs/mapBase.png b/platform/icons/src/vcs/mapBase.png Binary files differindex 513fb9d966bc..226446df1707 100644 --- a/platform/icons/src/vcs/mapBase.png +++ b/platform/icons/src/vcs/mapBase.png diff --git a/platform/icons/src/vcs/merge.png b/platform/icons/src/vcs/merge.png Binary files differindex 629cb1a8907f..4821f2791077 100644 --- a/platform/icons/src/vcs/merge.png +++ b/platform/icons/src/vcs/merge.png diff --git a/platform/icons/src/vcs/mergeSourcesTree.png b/platform/icons/src/vcs/mergeSourcesTree.png Binary files differindex e1b5bcece78b..7a2e3451fa35 100644 --- a/platform/icons/src/vcs/mergeSourcesTree.png +++ b/platform/icons/src/vcs/mergeSourcesTree.png diff --git a/platform/icons/src/vcs/not_equal.png b/platform/icons/src/vcs/not_equal.png Binary files differindex b91d6e7e4516..86827662ff5a 100644 --- a/platform/icons/src/vcs/not_equal.png +++ b/platform/icons/src/vcs/not_equal.png diff --git a/platform/icons/src/vcs/remove.png b/platform/icons/src/vcs/remove.png Binary files differindex 721c469e6172..c6ff278b556f 100644 --- a/platform/icons/src/vcs/remove.png +++ b/platform/icons/src/vcs/remove.png diff --git a/platform/icons/src/vcs/resetStrip.png b/platform/icons/src/vcs/resetStrip.png Binary files differindex f688e4844b7f..8490428bf5a4 100644 --- a/platform/icons/src/vcs/resetStrip.png +++ b/platform/icons/src/vcs/resetStrip.png diff --git a/platform/icons/src/vcs/stripDown.png b/platform/icons/src/vcs/stripDown.png Binary files differindex 81b5d3cbec7f..2879f443d057 100644 --- a/platform/icons/src/vcs/stripDown.png +++ b/platform/icons/src/vcs/stripDown.png diff --git a/platform/icons/src/vcs/stripNull.png b/platform/icons/src/vcs/stripNull.png Binary files differindex 6adb60668edb..da270a564757 100644 --- a/platform/icons/src/vcs/stripNull.png +++ b/platform/icons/src/vcs/stripNull.png diff --git a/platform/icons/src/vcs/stripUp.png b/platform/icons/src/vcs/stripUp.png Binary files differindex 6c5c812ff161..2b227f178e07 100644 --- a/platform/icons/src/vcs/stripUp.png +++ b/platform/icons/src/vcs/stripUp.png diff --git a/platform/icons/src/webreferences/server.png b/platform/icons/src/webreferences/server.png Binary files differindex e5bf3d23bace..39f9d8c97f63 100644 --- a/platform/icons/src/webreferences/server.png +++ b/platform/icons/src/webreferences/server.png diff --git a/platform/icons/src/welcome/createDesktopEntry.png b/platform/icons/src/welcome/createDesktopEntry.png Binary files differindex f97499510d0d..af2d8e54afd0 100644 --- a/platform/icons/src/welcome/createDesktopEntry.png +++ b/platform/icons/src/welcome/createDesktopEntry.png diff --git a/platform/icons/src/xml/browsers/canary16.png b/platform/icons/src/xml/browsers/canary16.png Binary files differindex 1630faf761f5..729f7159a3b0 100644 --- a/platform/icons/src/xml/browsers/canary16.png +++ b/platform/icons/src/xml/browsers/canary16.png diff --git a/platform/icons/src/xml/browsers/chrome16.png b/platform/icons/src/xml/browsers/chrome16.png Binary files differindex 72c34ed90672..9d2be0815699 100644 --- a/platform/icons/src/xml/browsers/chrome16.png +++ b/platform/icons/src/xml/browsers/chrome16.png diff --git a/platform/icons/src/xml/browsers/chromium16.png b/platform/icons/src/xml/browsers/chromium16.png Binary files differindex 904c70766341..0dfb6eb606fb 100644 --- a/platform/icons/src/xml/browsers/chromium16.png +++ b/platform/icons/src/xml/browsers/chromium16.png diff --git a/platform/icons/src/xml/browsers/explorer16.png b/platform/icons/src/xml/browsers/explorer16.png Binary files differindex 67fee9619a25..c6d2d2e569e9 100644 --- a/platform/icons/src/xml/browsers/explorer16.png +++ b/platform/icons/src/xml/browsers/explorer16.png diff --git a/platform/icons/src/xml/browsers/firefox16.png b/platform/icons/src/xml/browsers/firefox16.png Binary files differindex cc57722a8a6e..2f32a1a424e2 100644 --- a/platform/icons/src/xml/browsers/firefox16.png +++ b/platform/icons/src/xml/browsers/firefox16.png diff --git a/platform/icons/src/xml/browsers/opera16.png b/platform/icons/src/xml/browsers/opera16.png Binary files differindex 0b4f83e697eb..e736fef501a0 100644 --- a/platform/icons/src/xml/browsers/opera16.png +++ b/platform/icons/src/xml/browsers/opera16.png diff --git a/platform/icons/src/xml/browsers/safari16.png b/platform/icons/src/xml/browsers/safari16.png Binary files differindex 3978c63b97e7..406333542150 100644 --- a/platform/icons/src/xml/browsers/safari16.png +++ b/platform/icons/src/xml/browsers/safari16.png diff --git a/platform/icons/src/xml/browsers/yandex16.png b/platform/icons/src/xml/browsers/yandex16.png Binary files differindex 70b974ab8638..1cc14d73297e 100644 --- a/platform/icons/src/xml/browsers/yandex16.png +++ b/platform/icons/src/xml/browsers/yandex16.png diff --git a/platform/icons/src/xml/css_class.png b/platform/icons/src/xml/css_class.png Binary files differindex 3fbb5c126a45..18cfbcad783f 100644 --- a/platform/icons/src/xml/css_class.png +++ b/platform/icons/src/xml/css_class.png diff --git a/platform/icons/src/xml/html5.png b/platform/icons/src/xml/html5.png Binary files differindex d6a9e516eb76..c3961acbe888 100644 --- a/platform/icons/src/xml/html5.png +++ b/platform/icons/src/xml/html5.png diff --git a/platform/icons/src/xml/html_id.png b/platform/icons/src/xml/html_id.png Binary files differindex 5df7010b99c5..22d06ce4bda2 100644 --- a/platform/icons/src/xml/html_id.png +++ b/platform/icons/src/xml/html_id.png diff --git a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java index f2533463f855..ce12c57e10d9 100644 --- a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java +++ b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java @@ -64,12 +64,27 @@ public abstract class StubIndex { return get(indexKey, key, project, scope); } - public abstract <Key, Psi extends PsiElement> boolean process(@NotNull StubIndexKey<Key, Psi> indexKey, + /** + * @deprecated use processElements + */ + public <Key, Psi extends PsiElement> boolean process(@NotNull StubIndexKey<Key, Psi> indexKey, + @NotNull Key key, + @NotNull Project project, + GlobalSearchScope scope, + @NotNull Processor<? super Psi> processor) { + return processElements(indexKey, key, project, scope, (Class<Psi>)PsiElement.class, processor); + } + + public abstract <Key, Psi extends PsiElement> boolean processElements(@NotNull StubIndexKey<Key, Psi> indexKey, @NotNull Key key, @NotNull Project project, GlobalSearchScope scope, + Class<Psi> requiredClass, @NotNull Processor<? super Psi> processor); + /** + * @deprecated use processElements + */ public <Key, Psi extends PsiElement> boolean process(@NotNull StubIndexKey<Key, Psi> indexKey, @NotNull Key key, @NotNull Project project, @@ -79,6 +94,16 @@ public abstract class StubIndex { return process(indexKey, key, project, scope, processor); } + public <Key, Psi extends PsiElement> boolean processElements(@NotNull StubIndexKey<Key, Psi> indexKey, + @NotNull Key key, + @NotNull Project project, + GlobalSearchScope scope, + IdFilter idFilter, + Class<Psi> requiredClass, + @NotNull Processor<? super Psi> processor) { + return process(indexKey, key, project, scope, processor); + } + @NotNull public abstract <Key> Collection<Key> getAllKeys(@NotNull StubIndexKey<Key, ?> indexKey, @NotNull Project project); diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java index f5807c42556f..4ad94f5865fc 100644 --- a/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java +++ b/platform/indexing-impl/src/com/intellij/psi/impl/cache/impl/id/IdIndex.java @@ -122,7 +122,7 @@ public class IdIndex extends FileBasedIndexExtension<IdIndexEntry, Integer> { return myInputFilter; } - private static boolean isIndexable(FileType fileType) { + public static boolean isIndexable(FileType fileType) { return fileType instanceof LanguageFileType || fileType instanceof CustomSyntaxTableFileType || IdTableBuilding.isIdIndexerRegistered(fileType) || diff --git a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java index 6b2493373fb4..a01cfb1c316f 100644 --- a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java +++ b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java @@ -32,21 +32,21 @@ public abstract class StubProcessingHelperBase { return stub.getStubType(); } - public <Psi extends PsiElement> boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor<? super Psi> processor) { - return processStubsInFile(project, file, value, processor, false); + public <Psi extends PsiElement> boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor<? super Psi> processor, Class<Psi> requiredClass) { + return processStubsInFile(project, file, value, processor, requiredClass, false); } - public <Psi extends PsiElement> boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor<? super Psi> processor, final boolean skipOnErrors) { + public <Psi extends PsiElement> boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor<? super Psi> processor, Class<Psi> requiredClass, final boolean skipOnErrors) { StubTree stubTree = null; - PsiFile _psifile = PsiManager.getInstance(project).findFile(file); + PsiFile candidatePsiFile = PsiManager.getInstance(project).findFile(file); PsiFileWithStubSupport psiFile = null; boolean customStubs = false; - if (_psifile != null && !(_psifile instanceof PsiPlainTextFile)) { - _psifile = _psifile.getViewProvider().getStubBindingRoot(); - if (_psifile instanceof PsiFileWithStubSupport) { - psiFile = (PsiFileWithStubSupport)_psifile; + if (candidatePsiFile != null && !(candidatePsiFile instanceof PsiPlainTextFile)) { + candidatePsiFile = candidatePsiFile.getViewProvider().getStubBindingRoot(); + if (candidatePsiFile instanceof PsiFileWithStubSupport) { + psiFile = (PsiFileWithStubSupport)candidatePsiFile; stubTree = psiFile.getStubTree(); if (stubTree == null && psiFile instanceof PsiFileImpl) { IElementType contentElementType = ((PsiFileImpl)psiFile).getContentElementType(); @@ -91,6 +91,10 @@ public abstract class StubProcessingHelperBase { if (tree.getElementType() == stubType(stub)) { Psi psi = (Psi)tree.getPsi(); PsiUtilCore.ensureValid(psi); + if (!skipOnErrors && !requiredClass.isInstance(psi)) { + inconsistencyDetected(stubTree, psiFile); + break; + } if (!processor.process(psi)) return false; } else if (!skipOnErrors) { @@ -121,31 +125,32 @@ public abstract class StubProcessingHelperBase { final int stubTreeIndex = value.get(i); if (stubTreeIndex >= plained.size()) { if (!skipOnErrors) { - final VirtualFile virtualFile = psiFile.getVirtualFile(); - StubTree stubTreeFromIndex = (StubTree)StubTreeLoader.getInstance().readFromVFile(project, file); - LOG.error(stubTreeAndIndexDoNotMatch(stubTree, psiFile, plained, virtualFile, stubTreeFromIndex)); - - onInternalError(file); + inconsistencyDetected(stubTree, psiFile); } break; } Psi psi = (Psi)plained.get(stubTreeIndex).getPsi(); PsiUtilCore.ensureValid(psi); + if (!skipOnErrors && !requiredClass.isInstance(psi)) { + inconsistencyDetected(stubTree, psiFile); + break; + } if (!processor.process(psi)) return false; } } return true; } + private void inconsistencyDetected(StubTree stubTree, PsiFileWithStubSupport psiFile) { + LOG.error(stubTreeAndIndexDoNotMatch(stubTree, psiFile)); + onInternalError(psiFile.getVirtualFile()); + } + /*** * Returns a message to log when stub tree and index do not match */ - protected abstract Object stubTreeAndIndexDoNotMatch(StubTree stubTree, - PsiFileWithStubSupport psiFile, - List<StubElement<?>> plained, - VirtualFile virtualFile, - StubTree stubTreeFromIndex); + protected abstract Object stubTreeAndIndexDoNotMatch(StubTree stubTree, PsiFileWithStubSupport psiFile); protected abstract void onInternalError(VirtualFile file); diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java b/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java index 65a6db89d1b0..831e056e7efb 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.java +++ b/platform/lang-api/src/com/intellij/codeInsight/completion/CompletionContributor.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. @@ -254,8 +254,9 @@ public abstract class CompletionContributor { super("com.intellij.completion.contributor"); } + @NotNull @Override - protected List<CompletionContributor> buildExtensions(String stringKey, Language key) { + protected List<CompletionContributor> buildExtensions(@NotNull String stringKey, @NotNull Language key) { final THashSet<String> allowed = new THashSet<String>(); while (key != null) { allowed.add(keyToString(key)); @@ -265,8 +266,9 @@ public abstract class CompletionContributor { return buildExtensions(allowed); } + @NotNull @Override - protected String keyToString(Language key) { + protected String keyToString(@NotNull Language key) { return key.getID(); } } diff --git a/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerProviders.java b/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerProviders.java index 55278d96fe28..077ede80f1bc 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerProviders.java +++ b/platform/lang-api/src/com/intellij/codeInsight/daemon/LineMarkerProviders.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +38,7 @@ public class LineMarkerProviders extends LanguageExtension<LineMarkerProvider> { @NotNull @Override - public List<LineMarkerProvider> allForLanguage(Language l) { + public List<LineMarkerProvider> allForLanguage(@NotNull Language l) { //TODO[kb] make this for all Language Extensions List<LineMarkerProvider> providers = super.allForLanguage(l); if (l == Language.ANY) return providers; diff --git a/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java b/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java index 9ea188f8440e..19e251a2096c 100644 --- a/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java +++ b/platform/lang-api/src/com/intellij/execution/runners/AsyncGenericProgramRunner.java @@ -34,10 +34,10 @@ import org.jetbrains.annotations.Nullable; */ public abstract class AsyncGenericProgramRunner<Settings extends RunnerSettings> extends BaseProgramRunner<Settings> { @Override - protected final void startRunProfile(@NotNull final ExecutionEnvironment environment, - @Nullable final Callback callback, - @NotNull final Project project, - @NotNull final RunProfileState state) throws ExecutionException { + protected final void execute(@NotNull final ExecutionEnvironment environment, + @Nullable final Callback callback, + @NotNull final Project project, + @NotNull final RunProfileState state) throws ExecutionException { prepare(project, environment, state).doWhenProcessed(new Consumer<RunProfileStarter>() { @Override public void consume(@Nullable final RunProfileStarter result) { @@ -79,14 +79,7 @@ public abstract class AsyncGenericProgramRunner<Settings extends RunnerSettings> @NotNull RunProfileState state, @Nullable RunContentDescriptor contentToReuse, @NotNull ExecutionEnvironment environment) throws ExecutionException { - RunContentDescriptor descriptor = starter == null ? null : starter.execute(project, executor, state, contentToReuse, environment); - if (descriptor != null) { - descriptor.setExecutionId(environment.getExecutionId()); - } - if (callback != null) { - callback.processStarted(descriptor); - } - return descriptor; + return postProcess(environment, starter == null ? null : starter.execute(project, executor, state, contentToReuse, environment), callback); } }, state, environment); } diff --git a/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java b/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java index 340155cda514..29c9e5be0767 100644 --- a/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java +++ b/platform/lang-api/src/com/intellij/execution/runners/BaseProgramRunner.java @@ -27,7 +27,7 @@ import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public abstract class BaseProgramRunner<Settings extends RunnerSettings> implements ProgramRunner<Settings> { +abstract class BaseProgramRunner<Settings extends RunnerSettings> implements ProgramRunner<Settings> { @Override @Nullable public Settings createConfigurationData(ConfigurationInfoProvider settingsProvider) { @@ -63,16 +63,16 @@ public abstract class BaseProgramRunner<Settings extends RunnerSettings> impleme Project project = environment.getProject(); RunManager.getInstance(project).refreshUsagesList(environment.getRunProfile()); - startRunProfile(environment, callback, project, state); + execute(environment, callback, project, state); } - protected abstract void startRunProfile(@NotNull ExecutionEnvironment environment, - @Nullable Callback callback, - @NotNull Project project, - @NotNull RunProfileState state) throws ExecutionException; + protected abstract void execute(@NotNull ExecutionEnvironment environment, + @Nullable Callback callback, + @NotNull Project project, + @NotNull RunProfileState state) throws ExecutionException; @Nullable - protected static RunContentDescriptor postProcess(@NotNull ExecutionEnvironment environment, @Nullable RunContentDescriptor descriptor, @Nullable Callback callback) { + static RunContentDescriptor postProcess(@NotNull ExecutionEnvironment environment, @Nullable RunContentDescriptor descriptor, @Nullable Callback callback) { if (descriptor != null) { descriptor.setExecutionId(environment.getExecutionId()); } diff --git a/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java b/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java index ae783ca31a4b..ec8ec49a790b 100644 --- a/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java +++ b/platform/lang-api/src/com/intellij/execution/runners/GenericProgramRunner.java @@ -36,7 +36,7 @@ public abstract class GenericProgramRunner<Settings extends RunnerSettings> exte public static final String CONTENT_TO_REUSE = CONTENT_TO_REUSE_DATA_KEY.getName(); @Override - protected void startRunProfile(@NotNull ExecutionEnvironment environment, @Nullable final Callback callback, @NotNull Project project, @NotNull RunProfileState state) + protected void execute(@NotNull ExecutionEnvironment environment, @Nullable final Callback callback, @NotNull Project project, @NotNull RunProfileState state) throws ExecutionException { ExecutionManager.getInstance(project).startRunProfile(new RunProfileStarter() { @Override @@ -45,14 +45,7 @@ public abstract class GenericProgramRunner<Settings extends RunnerSettings> exte @NotNull RunProfileState state, @Nullable RunContentDescriptor contentToReuse, @NotNull ExecutionEnvironment environment) throws ExecutionException { - RunContentDescriptor descriptor = doExecute(project, state, contentToReuse, environment); - if (descriptor != null) { - descriptor.setExecutionId(environment.getExecutionId()); - } - if (callback != null) { - callback.processStarted(descriptor); - } - return descriptor; + return postProcess(environment, doExecute(project, state, contentToReuse, environment), callback); } }, state, environment); } diff --git a/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java b/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java index 5b72e74bcb09..64972b0c8308 100644 --- a/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java +++ b/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ import java.util.List; * @see TreeStructureProvider#modify(com.intellij.ide.util.treeView.AbstractTreeNode, java.util.Collection, com.intellij.ide.projectView.ViewSettings) */ -public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> implements RootsProvider { +public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> implements RootsProvider, SettingsProvider { protected static final Logger LOG = Logger.getInstance("#com.intellij.ide.projectView.ProjectViewNode"); @@ -82,6 +82,7 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im return null; } + @Override public final ViewSettings getSettings() { return mySettings; } @@ -108,7 +109,7 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im Object value, ViewSettings settings) throws InstantiationException { - Object[] parameters = new Object[]{project, value, settings}; + Object[] parameters = {project, value, settings}; for (Constructor<? extends AbstractTreeNode> constructor : (Constructor<? extends AbstractTreeNode>[])nodeClass.getConstructors()) { if (constructor.getParameterTypes().length != 3) continue; try { @@ -164,6 +165,7 @@ public abstract class ProjectViewNode <Value> extends AbstractTreeNode<Value> im return false; } + @NotNull @Override public Collection<VirtualFile> getRoots() { Value value = getValue(); diff --git a/platform/lang-api/src/com/intellij/lang/LanguageFormatting.java b/platform/lang-api/src/com/intellij/lang/LanguageFormatting.java index 9d50bc53987b..b706cc018a8d 100644 --- a/platform/lang-api/src/com/intellij/lang/LanguageFormatting.java +++ b/platform/lang-api/src/com/intellij/lang/LanguageFormatting.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.formatting.CustomFormattingModelBuilder; import com.intellij.formatting.FormattingModelBuilder; import com.intellij.openapi.extensions.Extensions; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class LanguageFormatting extends LanguageExtension<FormattingModelBuilder> { @@ -33,12 +34,12 @@ public class LanguageFormatting extends LanguageExtension<FormattingModelBuilder } @Nullable - public FormattingModelBuilder forContext(PsiElement context) { + public FormattingModelBuilder forContext(@NotNull PsiElement context) { return forContext(context.getLanguage(), context); } @Nullable - public FormattingModelBuilder forContext(Language language, PsiElement context) { + public FormattingModelBuilder forContext(@NotNull Language language, @NotNull PsiElement context) { for (LanguageFormattingRestriction each : Extensions.getExtensions(LanguageFormattingRestriction.EXTENSION)) { if (!each.isFormatterAllowed(context)) return null; } diff --git a/platform/lang-api/src/com/intellij/lang/LanguageImportStatements.java b/platform/lang-api/src/com/intellij/lang/LanguageImportStatements.java index 08af0d511afa..d828c817e5cf 100644 --- a/platform/lang-api/src/com/intellij/lang/LanguageImportStatements.java +++ b/platform/lang-api/src/com/intellij/lang/LanguageImportStatements.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.lang; import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; import java.util.HashSet; import java.util.List; @@ -32,7 +33,8 @@ public class LanguageImportStatements extends LanguageExtension<ImportOptimizer> super("com.intellij.lang.importOptimizer"); } - public Set<ImportOptimizer> forFile(PsiFile file) { + @NotNull + public Set<ImportOptimizer> forFile(@NotNull PsiFile file) { Set<ImportOptimizer> optimizers = new HashSet<ImportOptimizer>(); for (PsiFile psiFile : file.getViewProvider().getAllFiles()) { List<ImportOptimizer> langOptimizers = allForLanguage(psiFile.getLanguage()); diff --git a/platform/lang-api/src/com/intellij/lang/LanguageNamesValidation.java b/platform/lang-api/src/com/intellij/lang/LanguageNamesValidation.java index 5a2ec6c42095..28664abd9cf6 100644 --- a/platform/lang-api/src/com/intellij/lang/LanguageNamesValidation.java +++ b/platform/lang-api/src/com/intellij/lang/LanguageNamesValidation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.lang; import com.intellij.lang.refactoring.NamesValidator; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; public class LanguageNamesValidation extends LanguageExtension<NamesValidator> { public static final LanguageNamesValidation INSTANCE = new LanguageNamesValidation(); @@ -31,7 +32,7 @@ public class LanguageNamesValidation extends LanguageExtension<NamesValidator> { protected static class DefaultNamesValidator implements NamesValidator { @Override - public boolean isIdentifier(final String name, final Project project) { + public boolean isIdentifier(@NotNull final String name, final Project project) { final int len = name.length(); if (len == 0) return false; @@ -45,7 +46,7 @@ public class LanguageNamesValidation extends LanguageExtension<NamesValidator> { } @Override - public boolean isKeyword(final String name, final Project project) { + public boolean isKeyword(@NotNull final String name, final Project project) { return false; } } diff --git a/platform/lang-api/src/com/intellij/lang/LanguageWordCompletion.java b/platform/lang-api/src/com/intellij/lang/LanguageWordCompletion.java index cd1406c5f830..14b8b15c7a84 100644 --- a/platform/lang-api/src/com/intellij/lang/LanguageWordCompletion.java +++ b/platform/lang-api/src/com/intellij/lang/LanguageWordCompletion.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.lang; import com.intellij.psi.tree.IElementType; +import org.jetbrains.annotations.NotNull; public class LanguageWordCompletion extends LanguageExtension<WordCompletionElementFilter> { public static final LanguageWordCompletion INSTANCE = new LanguageWordCompletion(); @@ -28,7 +29,7 @@ public class LanguageWordCompletion extends LanguageExtension<WordCompletionElem super("com.intellij.codeInsight.wordCompletionFilter", new DefaultWordCompletionFilter()); } - public boolean isEnabledIn(IElementType type) { + public boolean isEnabledIn(@NotNull IElementType type) { return forLanguage(type.getLanguage()).isWordCompletionEnabledIn(type); } }
\ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/lang/refactoring/NamesValidator.java b/platform/lang-api/src/com/intellij/lang/refactoring/NamesValidator.java index ed8bcdab75b2..dca296c07d41 100644 --- a/platform/lang-api/src/com/intellij/lang/refactoring/NamesValidator.java +++ b/platform/lang-api/src/com/intellij/lang/refactoring/NamesValidator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 @@ package com.intellij.lang.refactoring; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; /** * Instances of NamesValidator are obtained from {@link com.intellij.lang.Language} instance. @@ -30,7 +31,7 @@ public interface NamesValidator { * @param project the project in the context of which the check is done. * @return true if the string is a keyword, false otherwise. */ - boolean isKeyword(String name, Project project); + boolean isKeyword(@NotNull String name, Project project); /** * Checks if the specified string is a valid identifier in the custom language. @@ -38,5 +39,5 @@ public interface NamesValidator { * @param project the project in the context of which the check is done. * @return true if the string is a valid identifier, false otherwise. */ - boolean isIdentifier(String name, Project project); + boolean isIdentifier(@NotNull String name, Project project); } diff --git a/platform/lang-api/src/com/intellij/openapi/editor/LanguageIndentStrategy.java b/platform/lang-api/src/com/intellij/openapi/editor/LanguageIndentStrategy.java index 2f7b736836ae..dd99110e62b8 100644 --- a/platform/lang-api/src/com/intellij/openapi/editor/LanguageIndentStrategy.java +++ b/platform/lang-api/src/com/intellij/openapi/editor/LanguageIndentStrategy.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. @@ -35,7 +35,8 @@ public class LanguageIndentStrategy extends LanguageExtension<IndentStrategy> { super(EP_NAME, DEFAULT_INDENT_STRATEGY); } - public static @NotNull IndentStrategy getIndentStrategy(@Nullable PsiFile file) { + @NotNull + public static IndentStrategy getIndentStrategy(@Nullable PsiFile file) { if (file != null) { Language language = file.getLanguage(); IndentStrategy strategy = INSTANCE.forLanguage(language); @@ -52,7 +53,7 @@ public class LanguageIndentStrategy extends LanguageExtension<IndentStrategy> { private static class DefaultIndentStrategy implements IndentStrategy { @Override - public boolean canIndent(PsiElement element) { + public boolean canIndent(@NotNull PsiElement element) { return true; } } diff --git a/platform/lang-api/src/com/intellij/psi/AbstractElementManipulator.java b/platform/lang-api/src/com/intellij/psi/AbstractElementManipulator.java index 6aa9459e738f..5c8d7ebca07c 100644 --- a/platform/lang-api/src/com/intellij/psi/AbstractElementManipulator.java +++ b/platform/lang-api/src/com/intellij/psi/AbstractElementManipulator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.psi; import com.intellij.openapi.util.TextRange; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; /** * @author Dmitry Avdeev @@ -25,12 +26,13 @@ import com.intellij.util.IncorrectOperationException; public abstract class AbstractElementManipulator<T extends PsiElement> implements ElementManipulator<T> { @Override - public T handleContentChange(final T element, final String newContent) throws IncorrectOperationException { + public T handleContentChange(@NotNull final T element, final String newContent) throws IncorrectOperationException { return handleContentChange(element, getRangeInElement(element), newContent); } @Override - public TextRange getRangeInElement(final T element) { + @NotNull + public TextRange getRangeInElement(@NotNull final T element) { return new TextRange(0, element.getTextLength()); } } diff --git a/platform/lang-api/src/com/intellij/psi/ReferenceProviderType.java b/platform/lang-api/src/com/intellij/psi/ReferenceProviderType.java index 4ad9183d9ed2..3b339fdc3379 100644 --- a/platform/lang-api/src/com/intellij/psi/ReferenceProviderType.java +++ b/platform/lang-api/src/com/intellij/psi/ReferenceProviderType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,8 +30,9 @@ public class ReferenceProviderType { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.ReferenceProviderType"); private static final KeyedExtensionCollector<PsiReferenceProvider,ReferenceProviderType> COLLECTOR = new KeyedExtensionCollector<PsiReferenceProvider, ReferenceProviderType>(EP_NAME) { + @NotNull @Override - protected String keyToString(final ReferenceProviderType key) { + protected String keyToString(@NotNull final ReferenceProviderType key) { return key.myId; } }; diff --git a/platform/lang-api/src/com/intellij/psi/WeighingService.java b/platform/lang-api/src/com/intellij/psi/WeighingService.java index 88f542138f52..3665ff544fb8 100644 --- a/platform/lang-api/src/com/intellij/psi/WeighingService.java +++ b/platform/lang-api/src/com/intellij/psi/WeighingService.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,8 +29,9 @@ import java.util.List; */ public class WeighingService { private static final KeyedExtensionCollector<Weigher,Key> COLLECTOR = new KeyedExtensionCollector<Weigher, Key>("com.intellij.weigher") { + @NotNull @Override - protected String keyToString(final Key key) { + protected String keyToString(@NotNull final Key key) { return key.toString(); } }; diff --git a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java index 1cb4441d20b2..b85fcd8796fa 100644 --- a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java +++ b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java @@ -32,10 +32,8 @@ import com.intellij.openapi.fileEditor.TextEditor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.AsyncResult; import com.intellij.openapi.util.TextRange; -import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VFileProperty; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileSystem; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -43,7 +41,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.*; -public class PsiUtilBase extends PsiUtilCore { +public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.util.PsiUtilBase"); public static final Comparator<Language> LANGUAGE_COMPARATOR = new Comparator<Language>() { @Override @@ -207,6 +205,12 @@ public class PsiUtilBase extends PsiUtilCore { while (true); } + @Nullable + @Override + public Editor findEditorByPsiElement(@NotNull PsiElement element) { + return findEditor(element); + } + /** * Tries to find editor for the given element. * <p/> @@ -232,8 +236,7 @@ public class PsiUtilBase extends PsiUtilCore { return null; } - VirtualFileSystem fileSystem = virtualFile.getFileSystem(); - if (fileSystem instanceof LocalFileSystem) { + if (virtualFile.isInLocalFileSystem()) { // Try to find editor for the real file. final FileEditor[] editors = FileEditorManager.getInstance(psiFile.getProject()).getEditors(virtualFile); for (FileEditor editor : editors) { @@ -270,8 +273,6 @@ public class PsiUtilBase extends PsiUtilCore { PsiFileSystemItem psiFileSystemItem = (PsiFileSystemItem)element; return psiFileSystemItem.isValid() ? psiFileSystemItem.getVirtualFile() : null; } - else { - return null; - } + return null; } } diff --git a/platform/lang-api/src/com/intellij/refactoring/classMembers/DependentMembersCollectorBase.java b/platform/lang-api/src/com/intellij/refactoring/classMembers/DependentMembersCollectorBase.java index ec0a198fa2e4..1b774124d681 100644 --- a/platform/lang-api/src/com/intellij/refactoring/classMembers/DependentMembersCollectorBase.java +++ b/platform/lang-api/src/com/intellij/refactoring/classMembers/DependentMembersCollectorBase.java @@ -26,8 +26,8 @@ import java.util.Set; */ public abstract class DependentMembersCollectorBase<T extends PsiElement, C> { protected final HashSet<T> myCollection = new HashSet<T>(); - private final C myClass; - private final C mySuperClass; + protected final C myClass; + protected final C mySuperClass; public DependentMembersCollectorBase(C clazz, C superClass) { myClass = clazz; diff --git a/platform/lang-impl/lang-impl.iml b/platform/lang-impl/lang-impl.iml index d1580e0bc141..7528850108a3 100644 --- a/platform/lang-impl/lang-impl.iml +++ b/platform/lang-impl/lang-impl.iml @@ -30,6 +30,7 @@ <orderEntry type="library" name="gson" level="project" /> <orderEntry type="module" module-name="jps-model-impl" /> <orderEntry type="module" module-name="analysis-impl" exported="" /> + <orderEntry type="module" module-name="structure-view-impl" exported="" /> </component> </module> diff --git a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form index 4dc3d103cc51..9c73a83ed92a 100644 --- a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form +++ b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.form @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.application.options.editor.EditorSmartKeysConfigurable"> - <grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="10" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0"> + <grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="11" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> <xy x="20" y="20" width="500" height="400"/> @@ -10,7 +10,7 @@ <children> <vspacer id="a9cd"> <constraints> - <grid row="9" 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="10" 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="18e81" class="javax.swing.JCheckBox" binding="myCbSmartHome"> @@ -51,7 +51,7 @@ </component> <component id="278d0" class="javax.swing.JCheckBox" binding="myCbCamelWords"> <constraints> - <grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" 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="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text resource-bundle="messages/ApplicationBundle" key="checkbox.use.camelhumps.words"/> @@ -60,7 +60,7 @@ <grid id="6ebf" 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="5" right="5"/> <constraints> - <grid row="7" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/> + <grid row="8" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="1" fill="3" indent="0" use-parent-layout="false"/> </constraints> <properties/> <border type="none"/> @@ -88,7 +88,7 @@ </grid> <grid id="b08a8" binding="myAddonPanel" layout-manager="GridBagLayout"> <constraints> - <grid row="8" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/> + <grid row="9" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/> </constraints> <properties/> <border type="none"/> @@ -97,7 +97,7 @@ <grid id="5344e" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <margin top="0" left="0" bottom="0" right="0"/> <constraints> - <grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + <grid row="7" 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> @@ -135,17 +135,26 @@ </grid> <hspacer id="6cc57"> <constraints> - <grid row="6" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <grid row="7" 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> <component id="158ea" class="javax.swing.JCheckBox" binding="myCbSurroundSelectionOnTyping" default-binding="true"> <constraints> - <grid row="5" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> + <grid row="6" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/> </constraints> <properties> <text value="Surround selection on typing quote or brace"/> </properties> </component> + <component id="a64de" class="javax.swing.JCheckBox" binding="myCbReformatBlockOnTypingRBrace"> + <constraints> + <grid row="4" 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 resource-bundle="messages/ApplicationBundle" key="checkbox.reformat.on.typing.rbrace"/> + </properties> + </component> </children> </grid> </form> diff --git a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java index 37408febc6bb..daada36ed175 100644 --- a/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java +++ b/platform/lang-impl/src/com/intellij/application/options/editor/EditorSmartKeysConfigurable.java @@ -62,6 +62,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo private JCheckBox myCbInsertPairCurlyBraceOnEnter; private JCheckBox myCbInsertJavadocStubOnEnter; private JCheckBox myCbSurroundSelectionOnTyping; + private JCheckBox myCbReformatBlockOnTypingRBrace; private boolean myAddonsInitialized = false; private static final String NO_REFORMAT = ApplicationBundle.message("combobox.paste.reformat.none"); @@ -154,6 +155,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo myCbInsertPairBracket.setSelected(codeInsightSettings.AUTOINSERT_PAIR_BRACKET); myCbInsertPairQuote.setSelected(codeInsightSettings.AUTOINSERT_PAIR_QUOTE); + myCbReformatBlockOnTypingRBrace.setSelected(codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE); myCbCamelWords.setSelected(editorSettings.isCamelWords()); myCbSurroundSelectionOnTyping.setSelected(codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED); @@ -173,6 +175,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo codeInsightSettings.JAVADOC_STUB_ON_ENTER = myCbInsertJavadocStubOnEnter.isSelected(); codeInsightSettings.AUTOINSERT_PAIR_BRACKET = myCbInsertPairBracket.isSelected(); codeInsightSettings.AUTOINSERT_PAIR_QUOTE = myCbInsertPairQuote.isSelected(); + codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE = myCbReformatBlockOnTypingRBrace.isSelected(); codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED = myCbSurroundSelectionOnTyping.isSelected(); editorSettings.setCamelWords(myCbCamelWords.isSelected()); codeInsightSettings.REFORMAT_ON_PASTE = getReformatPastedBlockValue(); @@ -196,6 +199,7 @@ public class EditorSmartKeysConfigurable extends CompositeConfigurable<UnnamedCo isModified |= isModified(myCbInsertPairBracket, codeInsightSettings.AUTOINSERT_PAIR_BRACKET); isModified |= isModified(myCbInsertPairQuote, codeInsightSettings.AUTOINSERT_PAIR_QUOTE); + isModified |= isModified(myCbReformatBlockOnTypingRBrace, codeInsightSettings.REFORMAT_BLOCK_ON_RBRACE); isModified |= isModified(myCbCamelWords, editorSettings.isCamelWords()); isModified |= isModified(myCbSurroundSelectionOnTyping, codeInsightSettings.SURROUND_SELECTION_ON_QUOTE_TYPED); diff --git a/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLSettings.java b/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLSettings.java index 1a0ae8b6124d..2b859dade41b 100644 --- a/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLSettings.java +++ b/platform/lang-impl/src/com/intellij/codeEditor/printing/ExportToHTMLSettings.java @@ -25,7 +25,7 @@ import org.jetbrains.annotations.NonNls; name = "ExportToHTMLSettings", storages = { @Storage( - file = StoragePathMacros.PROJECT_FILE + file = StoragePathMacros.WORKSPACE_FILE )} ) public class ExportToHTMLSettings implements PersistentStateComponent<ExportToHTMLSettings> { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java index 32e20829847f..f389920b1be8 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/CodeInsightSettings.java @@ -111,6 +111,7 @@ public class CodeInsightSettings implements PersistentStateComponent<Element>, C public boolean AUTOINSERT_PAIR_BRACKET = true; public boolean AUTOINSERT_PAIR_QUOTE = true; + public boolean REFORMAT_BLOCK_ON_RBRACE = true; public int REFORMAT_ON_PASTE = INDENT_EACH_LINE; public static final int NO_REFORMAT = 1; 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 bdcb7779d981..5a84a20cb19e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/OptimizeImportsAction.java @@ -75,7 +75,7 @@ public class OptimizeImportsAction extends AnAction { text = CodeInsightBundle.message("process.scope.project", projectContext.getPresentableUrl()); } LayoutProjectCodeDialog dialog - = new LayoutProjectCodeDialog(project, CodeInsightBundle.message("process.optimize.imports"), text, false, FormatChangedTextUtil.hasChanges(project)); + = new LayoutProjectCodeDialog(project, CodeInsightBundle.message("process.optimize.imports"), text, false, false); dialog.show(); if (!dialog.isOK()) return; if (moduleContext != null) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/RearrangeCodeProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/actions/RearrangeCodeProcessor.java index 53b2473298a9..f679edcfa2fc 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/RearrangeCodeProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/RearrangeCodeProcessor.java @@ -67,9 +67,8 @@ public class RearrangeCodeProcessor extends AbstractLayoutCodeProcessor { RearrangeCommand rearranger = new RearrangeCommand(myProject, file, COMMAND_NAME); if (rearranger.couldRearrange()) { rearranger.run(); - return true; } - return false; + return true; } }); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form index f27be63f56da..97a3afccbb10 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form +++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form @@ -3,7 +3,7 @@ <grid id="59847" binding="myPanel" 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="4" bottom="0" right="0"/> <constraints> - <xy x="30" y="17" width="218" height="135"/> + <xy x="30" y="17" width="244" height="149"/> </constraints> <properties/> <border type="none"/> @@ -34,7 +34,7 @@ </component> <component id="a0a79" class="javax.swing.JCheckBox" binding="myOnlyChangedText"> <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"/> + <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 resource-bundle="messages/CodeInsightBundle" key="reformat.option.vcs.changed.region"/> @@ -47,7 +47,7 @@ </vspacer> <component id="cf942" class="javax.swing.JCheckBox" binding="myRearrangeEntriesCb"> <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"/> + <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="&Rearrange entries"/> diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index 3c816b0ecb28..a721c6f04aaa 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.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,9 +30,7 @@ import com.intellij.injected.editor.DocumentWindow; import com.intellij.lang.Language; import com.intellij.lang.injection.InjectedLanguageManager; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.*; @@ -60,6 +58,7 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.psi.util.PsiUtilBase; import com.intellij.psi.util.PsiUtilCore; import com.intellij.reference.SoftReference; +import com.intellij.util.DocumentUtil; import com.intellij.util.ThreeState; import com.intellij.util.concurrency.Semaphore; import org.jetbrains.annotations.NotNull; @@ -451,16 +450,10 @@ public class CodeCompletionHandlerBase { final OffsetMap hostMap = translateOffsetMapToHost(initContext, originalFile, hostFile, hostEditor); final PsiFile[] hostCopy = {null}; - CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + DocumentUtil.writeInRunUndoTransparentAction(new Runnable() { @Override public void run() { - AccessToken token = WriteAction.start(); - try { - hostCopy[0] = createFileCopy(hostFile, initContext.getStartOffset(), initContext.getSelectionEndOffset()); - } - finally { - token.finish(); - } + hostCopy[0] = createFileCopy(hostFile, initContext.getStartOffset(), initContext.getSelectionEndOffset()); } }); @@ -581,11 +574,11 @@ public class CodeCompletionHandlerBase { } - private static CompletionAssertions.WatchingInsertionContext insertItemHonorBlockSelection(CompletionProgressIndicator indicator, - LookupElement item, - char completionChar, - List<LookupElement> items, - CompletionLookupArranger.StatisticsUpdate update) { + private static CompletionAssertions.WatchingInsertionContext insertItemHonorBlockSelection(final CompletionProgressIndicator indicator, + final LookupElement item, + final char completionChar, + final List<LookupElement> items, + final CompletionLookupArranger.StatisticsUpdate update) { final Editor editor = indicator.getEditor(); final int caretOffset = editor.getCaretModel().getOffset(); @@ -593,6 +586,7 @@ public class CodeCompletionHandlerBase { if (idEndOffset < 0) { idEndOffset = CompletionInitializationContext.calcDefaultIdentifierEnd(editor, caretOffset); } + final int idEndOffsetDelta = idEndOffset - caretOffset; CompletionAssertions.WatchingInsertionContext context = null; if (editor.getSelectionModel().hasBlockSelection() && editor.getSelectionModel().getBlockSelectionEnds().length > 0) { @@ -629,7 +623,19 @@ public class CodeCompletionHandlerBase { } } else { - context = insertItem(indicator, item, completionChar, items, update, editor, caretOffset, idEndOffset); + final Ref<CompletionAssertions.WatchingInsertionContext> contextRef = new Ref<CompletionAssertions.WatchingInsertionContext>(); + final Caret primaryCaret = editor.getCaretModel().getPrimaryCaret(); + editor.getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + CompletionAssertions.WatchingInsertionContext currentContext = insertItem(indicator, item, completionChar, items, update, editor, + caret.getOffset(), caret.getOffset() + idEndOffsetDelta); + if (caret == primaryCaret) { + contextRef.set(currentContext); + } + } + }); + context = contextRef.get(); } return context; } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java index aee920b35de9..20362480480f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionData.java @@ -231,7 +231,7 @@ public class CompletionData { return substr.substring(i).trim(); } - public static LookupElement objectToLookupItem(Object object) { + public static LookupElement objectToLookupItem(@NotNull Object object) { if (object instanceof LookupElement) return (LookupElement)object; String s = null; 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 d07b0b45a83c..1a2433772062 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -199,7 +199,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement " will move caret down and up in the editor", null); } } else if (DumbService.isDumb(getProject())) { - myLookup.addAdvertisement("Completion results might be incomplete until indexing is complete", MessageType.WARNING.getPopupBackground()); + myLookup.addAdvertisement("The results might be incomplete while indexing is in progress", MessageType.WARNING.getPopupBackground()); } ProgressManager.checkCanceled(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CustomFileTypeCompletionContributor.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CustomFileTypeCompletionContributor.java index aabd9a2d2fbe..a0c3e3758e61 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CustomFileTypeCompletionContributor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CustomFileTypeCompletionContributor.java @@ -20,12 +20,14 @@ import com.intellij.ide.highlighter.custom.SyntaxTable; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.HighlighterIterator; import com.intellij.openapi.fileTypes.impl.CustomSyntaxTableFileType; +import com.intellij.openapi.project.DumbAware; import com.intellij.psi.CustomHighlighterTokenType; import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; import com.intellij.util.ProcessingContext; import org.jetbrains.annotations.NotNull; +import java.util.Collections; import java.util.Set; import static com.intellij.patterns.PlatformPatterns.psiElement; @@ -35,7 +37,7 @@ import static com.intellij.patterns.StandardPatterns.instanceOf; /** * @author yole */ -public class CustomFileTypeCompletionContributor extends CompletionContributor { +public class CustomFileTypeCompletionContributor extends CompletionContributor implements DumbAware { public CustomFileTypeCompletionContributor() { extend(CompletionType.BASIC, psiElement().inFile(psiFile().withFileType(instanceOf(CustomSyntaxTableFileType.class))), new CompletionProvider<CompletionParameters>() { @@ -56,6 +58,8 @@ public class CustomFileTypeCompletionContributor extends CompletionContributor { addVariants(resultSetWithPrefix, syntaxTable.getKeywords2()); addVariants(resultSetWithPrefix, syntaxTable.getKeywords3()); addVariants(resultSetWithPrefix, syntaxTable.getKeywords4()); + + WordCompletionContributor.addWordCompletionVariants(resultSetWithPrefix, parameters, Collections.<String>emptySet()); } }); } @@ -75,7 +79,7 @@ public class CustomFileTypeCompletionContributor extends CompletionContributor { private static void addVariants(CompletionResultSet resultSet, Set<String> keywords) { for (String keyword : keywords) { - resultSet.addElement(LookupElementBuilder.create(keyword)); + resultSet.addElement(LookupElementBuilder.create(keyword).bold()); } } 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 330440730999..d20e48149b1c 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 @@ -305,7 +305,7 @@ public class DaemonListeners implements Disposable { actionManagerEx.addAnActionListener(new MyAnActionListener(), this); virtualFileManager.addVirtualFileListener(new VirtualFileAdapter() { @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { String propertyName = event.getPropertyName(); if (VirtualFile.PROP_NAME.equals(propertyName)) { stopDaemonAndRestartAllFiles(); 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 a659e5c3396f..7d0909582b4c 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 @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +68,7 @@ public class ExternalToolPassFactory extends AbstractProjectComponent implements return new ExternalToolPass(this, file, editor, textRange.getStartOffset(), textRange.getEndOffset()); } - private static boolean externalAnnotatorsDefined(PsiFile file) { + private static boolean externalAnnotatorsDefined(@NotNull PsiFile file) { for (Language language : file.getViewProvider().getLanguages()) { final List<ExternalAnnotator> externalAnnotators = ExternalLanguageAnnotators.allForFile(language, file); if (!externalAnnotators.isEmpty()) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficLightRenderer.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficLightRenderer.java index f0db8a3d4fbf..9c4404a21d58 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficLightRenderer.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/TrafficLightRenderer.java @@ -85,7 +85,7 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable { if (project != null) { final MarkupModelEx model = (MarkupModelEx)DocumentMarkupModel.forDocument(document, project, true); - model.addMarkupModelListener(this, new MarkupModelListener() { + model.addMarkupModelListener(this, new MarkupModelListener.Adapter() { @Override public void afterAdded(@NotNull RangeHighlighterEx highlighter) { incErrorCount(highlighter, 1); @@ -95,10 +95,6 @@ public class TrafficLightRenderer implements ErrorStripeRenderer, Disposable { public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) { incErrorCount(highlighter, -1); } - - @Override - public void attributesChanged(@NotNull RangeHighlighterEx highlighter, boolean renderersChanged) { - } }); UIUtil.invokeLaterIfNeeded(new Runnable() { @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java index 07923f11d5c5..8253873421fe 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/SelectWordUtil.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,7 +65,7 @@ public class SelectWordUtil { return SELECTIONERS; } - private static final CharCondition JAVA_IDENTIFIER_PART_CONDITION = new CharCondition() { + public static final CharCondition JAVA_IDENTIFIER_PART_CONDITION = new CharCondition() { @Override public boolean value(char ch) { return Character.isJavaIdentifierPart(ch); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java index d825a624b6c3..216227d7744c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java @@ -33,10 +33,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; 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.EditorModificationUtil; -import com.intellij.openapi.editor.ScrollType; +import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.actionSystem.TypedActionHandler; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.highlighter.EditorHighlighter; @@ -138,7 +135,10 @@ public class TypedHandler extends TypedActionHandlerBase { Project project = CommonDataKeys.PROJECT.getData(dataContext); PsiFile file; - if (project == null || editor.isColumnMode() || (file = PsiUtilBase.getPsiFileInEditor(editor, project)) == null) { + if (project == null + || editor.isColumnMode() + || editor.getCaretModel().getAllCarets().size() > 1 + || (file = PsiUtilBase.getPsiFileInEditor(editor, project)) == null) { if (myOriginalHandler != null){ myOriginalHandler.execute(editor, charTyped, dataContext); } @@ -579,13 +579,36 @@ public class TypedHandler extends TypedActionHandlerBase { final FileType fileType = file.getFileType(); BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator); - final boolean isBrace = braceMatcher.isLBraceToken(iterator, chars, fileType) || braceMatcher.isRBraceToken(iterator, chars, fileType); + boolean rBraceToken = braceMatcher.isRBraceToken(iterator, chars, fileType); + final boolean isBrace = braceMatcher.isLBraceToken(iterator, chars, fileType) || rBraceToken; + int lBraceOffset = -1; + + if (CodeInsightSettings.getInstance().REFORMAT_BLOCK_ON_RBRACE && + rBraceToken && + braceMatcher.isStructuralBrace(iterator, chars, fileType) && offset > 0) { + lBraceOffset = BraceMatchingUtil.findLeftLParen( + highlighter.createIterator(offset - 1), + braceMatcher.getOppositeBraceTokenType(iterator.getTokenType()), + editor.getDocument().getCharsSequence(), + fileType + ); + } if (element.getNode() != null && isBrace) { + final int finalLBraceOffset = lBraceOffset; ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run(){ try{ - int newOffset = CodeStyleManager.getInstance(project).adjustLineIndent(file, offset); + int newOffset; + if (finalLBraceOffset != -1) { + RangeMarker marker = document.createRangeMarker(offset, offset + 1); + CodeStyleManager.getInstance(project).reformatRange(file, finalLBraceOffset, offset, true); + newOffset = marker.getStartOffset(); + marker.dispose(); + } else { + newOffset = CodeStyleManager.getInstance(project).adjustLineIndent(file, offset); + } + editor.getCaretModel().moveToOffset(newOffset + 1); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); editor.getSelectionModel().removeSelection(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/UnSelectWordHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/UnSelectWordHandler.java index ca3f22fff9bb..cb1d0a6f2be9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/UnSelectWordHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/UnSelectWordHandler.java @@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.FoldRegion; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; @@ -54,7 +55,7 @@ public class UnSelectWordHandler extends EditorActionHandler { } - private static void doAction(Editor editor, PsiFile file) { + private static void doAction(final Editor editor, PsiFile file) { if (file instanceof PsiCompiledFile) { file = ((PsiCompiledFile)file).getDecompiledPsiFile(); if (file == null) return; @@ -108,7 +109,9 @@ public class UnSelectWordHandler extends EditorActionHandler { SelectWordUtil.processRanges(element, text, cursorOffset, editor, new Processor<TextRange>() { @Override public boolean process(TextRange range) { - if (selectionRange.contains(range) && !range.equals(selectionRange) && (range.contains(finalCursorOffset) || finalCursorOffset == range.getEndOffset())) { + if (selectionRange.contains(range) && !range.equals(selectionRange) && + (range.contains(finalCursorOffset) || finalCursorOffset == range.getEndOffset()) && + !isOffsetCollapsed(range.getStartOffset()) && !isOffsetCollapsed(range.getEndOffset())) { if (maximumRange.get() == null || range.contains(maximumRange.get())) { maximumRange.set(range); } @@ -116,6 +119,11 @@ public class UnSelectWordHandler extends EditorActionHandler { return false; } + + private boolean isOffsetCollapsed(int offset) { + FoldRegion region = editor.getFoldingModel().getCollapsedRegionAtOffset(offset); + return region != null && region.getStartOffset() != offset && region.getEndOffset() != offset; + } }); TextRange range = maximumRange.get(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java index facdaf812a4b..48c1dfbef792 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/enter/BaseIndentEnterHandler.java @@ -19,7 +19,6 @@ import com.intellij.lang.Language; import com.intellij.lang.LanguageFormatting; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorModificationUtil; @@ -55,6 +54,7 @@ public class BaseIndentEnterHandler extends EnterHandlerDelegateAdapter { private final IElementType myLineCommentType; private final String myLineCommentPrefix; private final TokenSet myWhitespaceTokens; + private final boolean myWorksWithFormatter; public BaseIndentEnterHandler( final Language language, @@ -63,11 +63,24 @@ public class BaseIndentEnterHandler extends EnterHandlerDelegateAdapter { final String lineCommentPrefix, final TokenSet whitespaceTokens) { + this(language, indentTokens, lineCommentType, lineCommentPrefix, whitespaceTokens, false); + } + + + public BaseIndentEnterHandler( + final Language language, + final TokenSet indentTokens, + final IElementType lineCommentType, + final String lineCommentPrefix, + final TokenSet whitespaceTokens, + final boolean worksWithFormatter) + { myLanguage = language; myIndentTokens = indentTokens; myLineCommentType = lineCommentType; myLineCommentPrefix = lineCommentPrefix; myWhitespaceTokens = whitespaceTokens; + myWorksWithFormatter = worksWithFormatter; } @Override @@ -100,6 +113,9 @@ public class BaseIndentEnterHandler extends EnterHandlerDelegateAdapter { PsiDocumentManager.getInstance(project).commitDocument(document); int caret = editor.getCaretModel().getOffset(); + if (caret == 0) { + return Result.DefaultSkipIndent; + } if (caret <= 0) { return Result.Continue; } @@ -131,7 +147,7 @@ public class BaseIndentEnterHandler extends EnterHandlerDelegateAdapter { } } - if (LanguageFormatting.INSTANCE.forLanguage(myLanguage) != null) { + if (!myWorksWithFormatter && LanguageFormatting.INSTANCE.forLanguage(myLanguage) != null) { return Result.Continue; } else { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/LanguageFillParagraphExtension.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/LanguageFillParagraphExtension.java index 8125e8e1b8c9..80d582c91dbb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/LanguageFillParagraphExtension.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/fillParagraph/LanguageFillParagraphExtension.java @@ -1,13 +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.codeInsight.editorActions.fillParagraph; import com.intellij.lang.LanguageExtension; +import org.jetbrains.annotations.NonNls; /** * User : ktisha */ public class LanguageFillParagraphExtension extends LanguageExtension<ParagraphFillHandler> { - public static final String EP_NAME = "com.intellij.codeInsight.fillParagraph"; + @NonNls public static final String EP_NAME = "com.intellij.codeInsight.fillParagraph"; public static final LanguageFillParagraphExtension INSTANCE = new LanguageFillParagraphExtension(); public LanguageFillParagraphExtension() { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandRegionAction.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandRegionAction.java index e2dbf16cac92..3eadd2e3df95 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandRegionAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandRegionAction.java @@ -20,12 +20,12 @@ import com.intellij.codeInsight.folding.CodeFoldingManager; import com.intellij.codeInsight.folding.impl.FoldingUtil; 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.FoldRegion; import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ExpandRegionAction extends EditorAction { @@ -47,10 +47,14 @@ public class ExpandRegionAction extends EditorAction { public static void expandRegionAtCaret(final Project project, @Nullable final Editor editor) { if (editor == null) return; + expandRegionAtOffset(project, editor, editor.getCaretModel().getOffset()); + } + + public static void expandRegionAtOffset(@NotNull Project project, @NotNull final Editor editor, final int offset) { CodeFoldingManager foldingManager = CodeFoldingManager.getInstance(project); foldingManager.updateFoldRegions(editor); - final int line = editor.getCaretModel().getLogicalPosition().line; + final int line = editor.getDocument().getLineNumber(offset); Runnable processor = new Runnable() { @Override public void run() { @@ -59,7 +63,6 @@ public class ExpandRegionAction extends EditorAction { region.setExpanded(true); } else{ - int offset = editor.getCaretModel().getOffset(); FoldRegion[] regions = FoldingUtil.getFoldRegionsAtOffset(editor, offset); for(int i = regions.length - 1; i >= 0; i--){ region = regions[i]; 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 7fe93edca8fe..b4a3bed19422 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByBlockCommentHandler.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. @@ -298,14 +298,14 @@ public class CommentByBlockCommentHandler implements CodeInsightActionHandler { } commentedRange = getSelectedComments(text, prefix, suffix); - if (commentedRange == null) { - PsiElement comment = findCommentAtCaret(); - if (comment != null) { + } + if (commentedRange == null) { + PsiElement comment = findCommentAtCaret(); + if (comment != null) { - String commentText = comment.getText(); - if (commentText.startsWith(prefix) && commentText.endsWith(suffix)) { - commentedRange = comment.getTextRange(); - } + String commentText = comment.getText(); + if (commentText.startsWith(prefix) && commentText.endsWith(suffix)) { + commentedRange = comment.getTextRange(); } } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java index be65138e5d35..a461ab9d61b1 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/surroundWith/SurroundWithHandler.java @@ -115,6 +115,7 @@ public class SurroundWithHandler implements CodeInsightActionHandler { element1 = file.findElementAt(startOffset); final Language baseLanguage = file.getViewProvider().getBaseLanguage(); + assert element1 != null; final Language l = element1.getParent().getLanguage(); List<SurroundDescriptor> surroundDescriptors = new ArrayList<SurroundDescriptor>(); @@ -288,7 +289,7 @@ public class SurroundWithHandler implements CodeInsightActionHandler { public void actionPerformed(AnActionEvent e) { new WriteCommandAction(myProject) { @Override - protected void run(Result result) throws Exception { + protected void run(@NotNull Result result) throws Exception { doSurround(myProject, myEditor, mySurrounder, myElements); } }.execute(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java index c9d4d88d9529..c3fc814181b3 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java @@ -301,6 +301,40 @@ public class BraceMatchingUtil { return lastLbraceOffset; } + public static int findLeftLParen(HighlighterIterator iterator, + IElementType lparenTokenType, + CharSequence fileText, + FileType fileType) { + int lastLbraceOffset = -1; + + Stack<IElementType> braceStack = new Stack<IElementType>(); + for (; !iterator.atEnd(); iterator.retreat()) { + final IElementType tokenType = iterator.getTokenType(); + + if (isLBraceToken(iterator, fileText, fileType)) { + if (!braceStack.isEmpty()) { + IElementType topToken = braceStack.pop(); + if (!isPairBraces(tokenType, topToken, fileType)) { + break; // unmatched braces + } + } + else { + if (tokenType == lparenTokenType) { + return iterator.getStart(); + } + else { + break; + } + } + } + else if (isRBraceToken(iterator, fileText, fileType)) { + braceStack.push(iterator.getTokenType()); + } + } + + return lastLbraceOffset; + } + // TODO: better name for this method public static int findRightmostRParen(HighlighterIterator iterator, IElementType rparenTokenType, diff --git a/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java index 36395b3bef79..867e4ac0b065 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/hint/ImplementationViewComponent.java @@ -22,8 +22,6 @@ import com.intellij.ide.highlighter.HighlighterFactory; import com.intellij.navigation.ItemPresentation; import com.intellij.navigation.NavigationItem; import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.ex.EditorEx; @@ -48,6 +46,7 @@ import com.intellij.ui.ScreenUtil; import com.intellij.ui.SideBorder; import com.intellij.ui.components.JBScrollPane; import com.intellij.usages.UsageView; +import com.intellij.util.DocumentUtil; import com.intellij.util.PairFunction; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -411,26 +410,20 @@ public class ImplementationViewComponent extends JPanel { private void updateTextElement(final PsiElement elt) { final String newText = getNewText(elt); if (newText == null || Comparing.strEqual(newText, myEditor.getDocument().getText())) return; - CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + DocumentUtil.writeInRunUndoTransparentAction(new Runnable() { @Override public void run() { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - Document fragmentDoc = myEditor.getDocument(); - fragmentDoc.setReadOnly(false); - - fragmentDoc.replaceString(0, fragmentDoc.getTextLength(), newText); - fragmentDoc.setReadOnly(true); - myEditor.getCaretModel().moveToOffset(0); - myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); - } - }); + Document fragmentDoc = myEditor.getDocument(); + fragmentDoc.setReadOnly(false); + + fragmentDoc.replaceString(0, fragmentDoc.getTextLength(), newText); + fragmentDoc.setReadOnly(true); + myEditor.getCaretModel().moveToOffset(0); + myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); } }); } - @Nullable public static String getNewText(PsiElement elt) { Project project = elt.getProject(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionUsagePanel.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionUsagePanel.java index af2573e9feab..d422881187cb 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionUsagePanel.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionUsagePanel.java @@ -19,8 +19,6 @@ */ package com.intellij.codeInsight.intention.impl.config; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.colors.CodeInsightColors; import com.intellij.openapi.editor.colors.EditorColorsManager; @@ -31,6 +29,7 @@ import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.DocumentUtil; import com.intellij.util.ui.RangeBlinker; import org.jetbrains.annotations.NonNls; @@ -58,15 +57,10 @@ class IntentionUsagePanel extends JPanel{ @Override public void run() { if (myEditor.isDisposed()) return; - CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + DocumentUtil.writeInRunUndoTransparentAction(new Runnable() { @Override public void run() { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - configureByText(usageText, fileType); - } - }); + configureByText(usageText, fileType); } }); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index b92155067b27..26115d4b307e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.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. @@ -678,9 +678,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable } private void insertLookupString(LookupElement item, final int prefix) { - Document document = myEditor.getDocument(); + final Document document = myEditor.getDocument(); - String lookupString = getCaseCorrectedLookupString(item); + final String lookupString = getCaseCorrectedLookupString(item); if (myEditor.getSelectionModel().hasBlockSelection()) { LogicalPosition blockStart = myEditor.getSelectionModel().getBlockStart(); @@ -710,20 +710,25 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable myEditor.getSelectionModel().setBlockSelection(start, end); myEditor.getCaretModel().moveToLogicalPosition(new LogicalPosition(caretLine, end.column)); } else { - EditorModificationUtil.deleteSelectedText(myEditor); - final int caretOffset = myEditor.getCaretModel().getOffset(); - int lookupStart = caretOffset - prefix; + myEditor.getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + EditorModificationUtil.deleteSelectedText(myEditor); + final int caretOffset = myEditor.getCaretModel().getOffset(); + int lookupStart = caretOffset - prefix; - int len = document.getTextLength(); - LOG.assertTrue(lookupStart >= 0 && lookupStart <= len, - "ls: " + lookupStart + " caret: " + caretOffset + " prefix:" + prefix + " doc: " + len); - LOG.assertTrue(caretOffset >= 0 && caretOffset <= len, "co: " + caretOffset + " doc: " + len); + int len = document.getTextLength(); + LOG.assertTrue(lookupStart >= 0 && lookupStart <= len, + "ls: " + lookupStart + " caret: " + caretOffset + " prefix:" + prefix + " doc: " + len); + LOG.assertTrue(caretOffset >= 0 && caretOffset <= len, "co: " + caretOffset + " doc: " + len); - document.replaceString(lookupStart, caretOffset, lookupString); + document.replaceString(lookupStart, caretOffset, lookupString); - int offset = lookupStart + lookupString.length(); - myEditor.getCaretModel().moveToOffset(offset); - myEditor.getSelectionModel().removeSelection(); + int offset = lookupStart + lookupString.length(); + myEditor.getCaretModel().moveToOffset(offset); + myEditor.getSelectionModel().removeSelection(); + } + }); } myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemAction.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemAction.java index cbcdb40e6978..9bcf2de2b9dd 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/actions/ChooseItemAction.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. @@ -112,9 +112,9 @@ public abstract class ChooseItemAction extends EditorAction { PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument()); final LiveTemplateLookupElement liveTemplateLookup = ContainerUtil.findInstance(lookup.getItems(), LiveTemplateLookupElement.class); - if (liveTemplateLookup == null) { - // Lookup doesn't contain live templates. It means that - // - there are no any live template: + if (liveTemplateLookup == null || !liveTemplateLookup.sudden) { + // Lookup doesn't contain sudden live templates. It means that + // - there are no live template with given key: // in this case we should find live template with appropriate prefix (custom live templates doesn't participate in this action). // - completion provider worked too long: // in this case we should check custom templates that provides completion lookup. diff --git a/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java index fd433b9e5938..3e0e26424bb5 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/navigation/CtrlMouseHandler.java @@ -138,17 +138,20 @@ public class CtrlMouseHandler extends AbstractProjectComponent { BrowseMode browseMode = getBrowseMode(modifiers); if (browseMode != BrowseMode.None) { - if (myTooltipProvider != null) { - if (browseMode != myTooltipProvider.getBrowseMode()) { + TooltipProvider tooltipProvider = myTooltipProvider; + if (tooltipProvider != null) { + if (browseMode != tooltipProvider.getBrowseMode()) { disposeHighlighter(); } myStoredModifiers = modifiers; + cancelPreviousTooltip(); + myTooltipProvider = new TooltipProvider(tooltipProvider.myEditor, tooltipProvider.myPosition); myTooltipProvider.execute(browseMode); } } else { disposeHighlighter(); - myTooltipProvider = null; + cancelPreviousTooltip(); } } }; @@ -157,7 +160,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent { @Override public void selectionChanged(@NotNull FileEditorManagerEvent e) { disposeHighlighter(); - myTooltipProvider = null; + cancelPreviousTooltip(); } }; @@ -165,7 +168,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent { @Override public void visibleAreaChanged(VisibleAreaEvent e) { disposeHighlighter(); - myTooltipProvider = null; + cancelPreviousTooltip(); } }; @@ -173,7 +176,7 @@ public class CtrlMouseHandler extends AbstractProjectComponent { @Override public void mouseReleased(EditorMouseEvent e) { disposeHighlighter(); - myTooltipProvider = null; + cancelPreviousTooltip(); } }; @@ -211,13 +214,10 @@ public class CtrlMouseHandler extends AbstractProjectComponent { myStoredModifiers = mouseEvent.getModifiers(); BrowseMode browseMode = getBrowseMode(myStoredModifiers); - if (myTooltipProvider != null) { - myTooltipProvider.dispose(); - } + cancelPreviousTooltip(); if (browseMode == BrowseMode.None || offset >= selStart && offset < selEnd) { disposeHighlighter(); - myTooltipProvider = null; return; } @@ -226,6 +226,13 @@ public class CtrlMouseHandler extends AbstractProjectComponent { } }; + private void cancelPreviousTooltip() { + if (myTooltipProvider != null) { + myTooltipProvider.dispose(); + myTooltipProvider = null; + } + } + @NotNull private final Alarm myDocAlarm; public CtrlMouseHandler(final Project project, diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/InvokeTemplateAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/InvokeTemplateAction.java index 083cd520181e..693b3dba1a24 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/InvokeTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/InvokeTemplateAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,26 +18,29 @@ package com.intellij.codeInsight.template.impl; import com.intellij.codeInsight.template.TemplateManager; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.command.CommandProcessor; +import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.CaretAction; import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.ReadonlyStatusHandler; -import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.ui.UIUtil; import java.util.Set; /** * @author peter -*/ + */ public class InvokeTemplateAction extends AnAction { private final TemplateImpl myTemplate; private final Editor myEditor; private final Project myProject; - public InvokeTemplateAction(final TemplateImpl template, final Editor editor, final Project project, final Set<Character> usedMnemonicsSet) { + public InvokeTemplateAction(TemplateImpl template, Editor editor, Project project, Set<Character> usedMnemonicsSet) { super(extractMnemonic(template.getKey(), usedMnemonicsSet) + ". " + template.getDescription()); myTemplate = template; myProject = project; @@ -73,27 +76,33 @@ public class InvokeTemplateAction extends AnAction { ReadonlyStatusHandler.getInstance(myProject).ensureFilesWritable(file); } - // adjust the selection so that it starts with a non-whitespace character (to make sure that the template is inserted - // at a meaningful position rather than at indent 0) - if (myEditor.getSelectionModel().hasSelection() && myTemplate.isToReformat()) { - int offset = myEditor.getSelectionModel().getSelectionStart(); - int selectionEnd = myEditor.getSelectionModel().getSelectionEnd(); - int lineEnd = document.getLineEndOffset(document.getLineNumber(offset)); - while(offset < lineEnd && offset < selectionEnd && - (document.getCharsSequence().charAt(offset) == ' ' || document.getCharsSequence().charAt(offset) == '\t')) { - offset++; - } - // avoid extra line break after $SELECTION$ in case when selection ends with a complete line - if (selectionEnd == document.getLineStartOffset(document.getLineNumber(selectionEnd))) { - selectionEnd--; - } - if (offset < lineEnd && offset < selectionEnd) { // found non-WS character in first line of selection - myEditor.getSelectionModel().setSelection(offset, selectionEnd); + CommandProcessor.getInstance().executeCommand(myProject, new Runnable() { + public void run() { + myEditor.getCaretModel().runForEachCaret(new CaretAction() { + public void perform(Caret caret) { + // adjust the selection so that it starts with a non-whitespace character (to make sure that the template is inserted + // at a meaningful position rather than at indent 0) + if (myEditor.getSelectionModel().hasSelection() && myTemplate.isToReformat()) { + int offset = myEditor.getSelectionModel().getSelectionStart(); + int selectionEnd = myEditor.getSelectionModel().getSelectionEnd(); + int lineEnd = document.getLineEndOffset(document.getLineNumber(offset)); + while (offset < lineEnd && offset < selectionEnd && + (document.getCharsSequence().charAt(offset) == ' ' || document.getCharsSequence().charAt(offset) == '\t')) { + offset++; + } + // avoid extra line break after $SELECTION$ in case when selection ends with a complete line + if (selectionEnd == document.getLineStartOffset(document.getLineNumber(selectionEnd))) { + selectionEnd--; + } + if (offset < lineEnd && offset < selectionEnd) { // found non-WS character in first line of selection + myEditor.getSelectionModel().setSelection(offset, selectionEnd); + } + } + String selectionString = myEditor.getSelectionModel().getSelectedText(); + TemplateManager.getInstance(myProject).startTemplate(myEditor, selectionString, myTemplate); + } + }); } - } - - String selectionString = myEditor.getSelectionModel().getSelectedText(); - - TemplateManager.getInstance(myProject).startTemplate(myEditor, selectionString, myTemplate); + }, "Wrap with template", "Wrap with template " + myTemplate.getKey()); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCompletionContributor.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCompletionContributor.java index 295e6e11f7cd..9b3e29783b42 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCompletionContributor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/LiveTemplateCompletionContributor.java @@ -20,6 +20,7 @@ import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.template.CustomLiveTemplate; import com.intellij.codeInsight.template.CustomTemplateCallback; import com.intellij.codeInsight.template.TemplateContextType; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Ref; @@ -41,6 +42,15 @@ import static com.intellij.codeInsight.template.impl.ListTemplatesHandler.listAp * @author peter */ public class LiveTemplateCompletionContributor extends CompletionContributor { + public static boolean ourShowTemplatesInTests = false; + + public static boolean shouldShowAllTemplates() { + if (ApplicationManager.getApplication().isUnitTestMode()) { + return ourShowTemplatesInTests; + } + return Registry.is("show.live.templates.in.completion"); + } + public LiveTemplateCompletionContributor() { extend(CompletionType.BASIC, PlatformPatterns.psiElement(), new CompletionProvider<CompletionParameters>() { @Override @@ -84,7 +94,7 @@ public class LiveTemplateCompletionContributor extends CompletionContributor { @SuppressWarnings("MethodMayBeStatic") //for Kotlin protected boolean showAllTemplates() { - return Registry.is("show.live.templates.in.completion"); + return shouldShowAllTemplates(); } private static void ensureTemplatesShown(Ref<Boolean> templatesShown, diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java index 05ecfadee46d..35e9fe538202 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateManagerImpl.java @@ -179,6 +179,7 @@ public class TemplateManagerImpl extends TemplateManager implements ProjectCompo final Map<String, String> predefinedVarValues) { final TemplateState templateState = initTemplateState(editor); + //noinspection unchecked templateState.getProperties().put(ExpressionContext.SELECTION, selectionString); if (listener != null) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java index 1ce2e351b3ed..72d6d056080d 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/TemplateState.java @@ -34,8 +34,10 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.colors.EditorColors; import com.intellij.openapi.editor.colors.EditorColorsManager; +import com.intellij.openapi.editor.event.CaretEvent; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; +import com.intellij.openapi.editor.event.MultipleCaretListener; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.editor.markup.HighlighterLayer; import com.intellij.openapi.editor.markup.HighlighterTargetArea; @@ -83,7 +85,8 @@ public class TemplateState implements Disposable { private boolean myDocumentChangesTerminateTemplate = true; private boolean myDocumentChanged = false; - private CommandAdapter myCommandListener; + @Nullable private CommandAdapter myCommandListener; + @Nullable private MultipleCaretListener myCaretListener; private final List<TemplateEditingListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); private DocumentAdapter myEditorDocumentListener; @@ -116,9 +119,9 @@ public class TemplateState implements Disposable { public void commandStarted(CommandEvent event) { if (myEditor != null) { final int offset = myEditor.getCaretModel().getOffset(); - myDocumentChangesTerminateTemplate = myCurrentSegmentNumber >= 0 && + myDocumentChangesTerminateTemplate = (myCurrentSegmentNumber >= 0 && (offset < mySegments.getSegmentStart(myCurrentSegmentNumber) || - offset > mySegments.getSegmentEnd(myCurrentSegmentNumber)); + offset > mySegments.getSegmentEnd(myCurrentSegmentNumber))); } started = true; } @@ -143,14 +146,41 @@ public class TemplateState implements Disposable { } }; + myCaretListener = new MultipleCaretListener() { + @Override + public void caretAdded(CaretEvent e) { + if (isMultiCaretMode()) { + finishTemplateEditing(false); + } + } + + @Override + public void caretRemoved(CaretEvent e) { + if (isMultiCaretMode()) { + finishTemplateEditing(false); + } + } + + @Override + public void caretPositionChanged(CaretEvent e) {} + }; + + if (myEditor != null) { + myEditor.getCaretModel().addCaretListener(myCaretListener); + } myDocument.addDocumentListener(myEditorDocumentListener, this); CommandProcessor.getInstance().addCommandListener(myCommandListener, this); } + private boolean isMultiCaretMode() { + return myEditor != null && myEditor.getCaretModel().supportsMultipleCarets() && myEditor.getCaretModel().getAllCarets().size() > 1; + } + @Override public synchronized void dispose() { myEditorDocumentListener = null; myCommandListener = null; + myCaretListener = null; myProcessor = null; @@ -173,7 +203,9 @@ public class TemplateState implements Disposable { private void setCurrentVariableNumber(int variableNumber) { myCurrentVariableNumber = variableNumber; final boolean isFinished = isFinished(); - ((DocumentEx)myDocument).setStripTrailingSpacesEnabled(isFinished); + if (myDocument != null) { + ((DocumentEx)myDocument).setStripTrailingSpacesEnabled(isFinished); + } myCurrentSegmentNumber = isFinished ? -1 : getCurrentSegmentNumber(); } @@ -358,7 +390,10 @@ public class TemplateState implements Disposable { initListeners(); focusCurrentExpression(); currentVariableChanged(-1); - } + if (isMultiCaretMode()) { + finishTemplateEditing(false); + } + } } }); } @@ -617,7 +652,7 @@ public class TemplateState implements Disposable { if (segmentNumber < 0) continue; Expression expression = myTemplate.getExpressionAt(i); Expression defaultValue = myTemplate.getDefaultValueAt(i); - String oldValue = getVariableValue(variableName).getText(); + String oldValue = getVariableValueText(variableName); recalcSegment(segmentNumber, isQuick, expression, defaultValue); final TextResult value = getVariableValue(variableName); assert value != null : "name=" + variableName + "\ntext=" + myTemplate.getTemplateText(); @@ -638,7 +673,7 @@ public class TemplateState implements Disposable { selectionCalculated = true; } if (TemplateImpl.END.equals(variableName)) continue; // No need to update end since it can be placed over some other variable - String newValue = getVariableValue(variableName).getText(); + String newValue = getVariableValueText(variableName); int start = mySegments.getSegmentStart(i); int end = mySegments.getSegmentEnd(i); replaceString(newValue, start, end, i); @@ -653,6 +688,12 @@ public class TemplateState implements Disposable { }); } + @NotNull + private String getVariableValueText(String variableName) { + TextResult value = getVariableValue(variableName); + return value != null ? value.getText() : ""; + } + private void recalcSegment(int segmentNumber, boolean isQuick, Expression expressionNode, Expression defaultValue) { String oldValue = getExpressionString(segmentNumber); int start = mySegments.getSegmentStart(segmentNumber); @@ -799,6 +840,7 @@ public class TemplateState implements Disposable { @Override public <T> T getProperty(Key<T> key) { + //noinspection unchecked return (T)myProperties.get(key); } @@ -811,7 +853,11 @@ public class TemplateState implements Disposable { PsiDocumentManager.getInstance(project).commitAllDocuments(); - PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(getEditor().getDocument()); + Editor editor = getEditor(); + if (editor == null) { + return null; + } + PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); return file == null ? null : file.findElementAt(offset); } }; @@ -861,6 +907,10 @@ public class TemplateState implements Disposable { } } + if (isMultiCaretMode() && getCurrentVariableNumber() > -1) { + offset = -1; //do not move caret in multicaret mode if at least one tab had been made already + } + if (offset >= 0) { myEditor.getCaretModel().moveToOffset(offset); myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java index 917faa551340..5e3a53365688 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/WrapWithCustomTemplateAction.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. @@ -34,7 +34,6 @@ import java.util.Set; * User: Eugene.Kudelevsky * Date: 25.03.2010 * Time: 1:50:53 - * To change this template use File | Settings | File Templates. */ public class WrapWithCustomTemplateAction extends AnAction { private final CustomLiveTemplate myTemplate; @@ -60,7 +59,7 @@ public class WrapWithCustomTemplateAction extends AnAction { ReadonlyStatusHandler.getInstance(myFile.getProject()).ensureFilesWritable(file); } - String selection = myEditor.getSelectionModel().getSelectedText(); + String selection = myEditor.getSelectionModel().getSelectedText(true); if (selection != null) { selection = selection.trim(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/EnterHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/EnterHandler.java index adf9c857ff53..f6749d595f5e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/EnterHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/EnterHandler.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,10 +21,10 @@ import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateSettings; 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.project.Project; +import com.intellij.psi.PsiDocumentManager; public class EnterHandler extends BaseEnterHandler { private final EditorActionHandler myOriginalHandler; @@ -42,6 +42,7 @@ public class EnterHandler extends BaseEnterHandler { public void executeWriteAction(Editor editor, DataContext dataContext) { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project != null) { + PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(project); if (templateManager != null && templateManager.startTemplate(editor, TemplateSettings.ENTER_CHAR)) { return; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java index 67aca8ebfc1f..13798639227f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/ExpandLiveTemplateByTabAction.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,16 +23,19 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler; import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiDocumentManager; /** * @author peter */ public class ExpandLiveTemplateByTabAction extends EditorAction { public ExpandLiveTemplateByTabAction() { - super(new EditorWriteActionHandler() { + super(new EditorWriteActionHandler(true) { @Override public void executeWriteAction(Editor editor, DataContext dataContext) { Project project = editor.getProject(); + assert project != null; + PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); TemplateManager.getInstance(project).startTemplate(editor, TemplateSettings.TAB_CHAR); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/SpaceHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/SpaceHandler.java index 3a03428e38ec..0cb84d5fb8f8 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/SpaceHandler.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/template/impl/editorActions/SpaceHandler.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,10 +20,10 @@ import com.intellij.codeInsight.template.impl.TemplateManagerImpl; import com.intellij.codeInsight.template.impl.TemplateSettings; 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.TypedActionHandler; import com.intellij.openapi.project.Project; +import com.intellij.psi.PsiDocumentManager; import org.jetbrains.annotations.NotNull; public class SpaceHandler extends TypedActionHandlerBase { @@ -36,6 +36,7 @@ public class SpaceHandler extends TypedActionHandlerBase { if (charTyped == ' ') { Project project = CommonDataKeys.PROJECT.getData(dataContext); if (project != null) { + PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); TemplateManagerImpl templateManager = (TemplateManagerImpl)TemplateManager.getInstance(project); if (templateManager != null && templateManager.startTemplate(editor, TemplateSettings.SPACE_CHAR)) { return; diff --git a/platform/lang-impl/src/com/intellij/execution/console/BaseConsoleExecuteActionHandler.java b/platform/lang-impl/src/com/intellij/execution/console/BaseConsoleExecuteActionHandler.java index 6df77d40681a..1ab34812695e 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/BaseConsoleExecuteActionHandler.java +++ b/platform/lang-impl/src/com/intellij/execution/console/BaseConsoleExecuteActionHandler.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. @@ -15,54 +15,20 @@ */ package com.intellij.execution.console; -import com.intellij.execution.process.ConsoleHistoryModel; -import com.intellij.openapi.command.impl.UndoManagerImpl; -import com.intellij.openapi.command.undo.DocumentReferenceManager; -import com.intellij.openapi.command.undo.UndoManager; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.util.TextRange; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public abstract class BaseConsoleExecuteActionHandler { - private boolean myAddCurrentToHistory = true; - private final ConsoleHistoryModel myConsoleHistoryModel; - private final boolean myPreserveMarkup; - +public abstract class BaseConsoleExecuteActionHandler extends ConsoleExecuteAction.ConsoleExecuteActionHandler { public BaseConsoleExecuteActionHandler(boolean preserveMarkup) { - myConsoleHistoryModel = new ConsoleHistoryModel(); - myPreserveMarkup = preserveMarkup; - } - - public ConsoleHistoryModel getConsoleHistoryModel() { - return myConsoleHistoryModel; - } - - public void setAddCurrentToHistory(boolean addCurrentToHistory) { - myAddCurrentToHistory = addCurrentToHistory; + super(preserveMarkup); } public void runExecuteAction(@NotNull LanguageConsoleView consoleView) { - runExecuteAction(consoleView, consoleView.getConsole()); + runExecuteAction(consoleView.getConsole(), consoleView); } - private void runExecuteAction(@Nullable LanguageConsoleView consoleView, @NotNull LanguageConsoleImpl console) { - // process input and add to history - Document document = console.getCurrentEditor().getDocument(); - String text = document.getText(); - TextRange range = new TextRange(0, document.getTextLength()); - - console.getCurrentEditor().getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset()); - - if (myAddCurrentToHistory) { - console.addCurrentToHistory(range, false, myPreserveMarkup); - } - - console.setInputText(""); - - ((UndoManagerImpl)UndoManager.getInstance(console.getProject())).invalidateActionsFor(DocumentReferenceManager.getInstance().create(document)); - - myConsoleHistoryModel.addToHistory(text); + @Override + final void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) { if (consoleView == null) { //noinspection deprecation execute(text); @@ -72,17 +38,18 @@ public abstract class BaseConsoleExecuteActionHandler { } } + protected void execute(@NotNull String text, @NotNull LanguageConsoleView console) { + //noinspection deprecation + execute(text); + } + + @SuppressWarnings("UnusedDeclaration") @Deprecated /** * @deprecated to remove in IDEA 15 */ public void runExecuteAction(@NotNull LanguageConsoleImpl languageConsole) { - runExecuteAction(null, languageConsole); - } - - protected void execute(@NotNull String text, @NotNull LanguageConsoleView console) { - //noinspection deprecation - execute(text); + runExecuteAction(languageConsole, null); } @Deprecated @@ -93,6 +60,12 @@ public abstract class BaseConsoleExecuteActionHandler { throw new AbstractMethodError(); } + @Deprecated + /** + * @deprecated to remove in IDEA 14 + * + * Never used. It is Python specific implementation. + */ public void finishExecution() { } diff --git a/platform/lang-impl/src/com/intellij/execution/console/ConsoleExecuteAction.java b/platform/lang-impl/src/com/intellij/execution/console/ConsoleExecuteAction.java index f912178ab475..9f8900eacbdd 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/ConsoleExecuteAction.java +++ b/platform/lang-impl/src/com/intellij/execution/console/ConsoleExecuteAction.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. @@ -17,51 +17,135 @@ package com.intellij.execution.console; import com.intellij.codeInsight.lookup.Lookup; import com.intellij.codeInsight.lookup.LookupManager; +import com.intellij.execution.process.ConsoleHistoryModel; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.EmptyAction; +import com.intellij.openapi.command.impl.UndoManagerImpl; +import com.intellij.openapi.command.undo.DocumentReferenceManager; +import com.intellij.openapi.command.undo.UndoManager; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Conditions; +import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ConsoleExecuteAction extends DumbAwareAction { static final String CONSOLE_EXECUTE_ACTION_ID = "Console.Execute"; - private final LanguageConsoleView myConsole; - private final BaseConsoleExecuteActionHandler myExecuteActionHandler; + private final LanguageConsoleView myConsoleView; + private final LanguageConsoleImpl myConsole; + private final ConsoleExecuteActionHandler myExecuteActionHandler; private final Condition<LanguageConsoleImpl> myEnabledCondition; + @SuppressWarnings("UnusedDeclaration") public ConsoleExecuteAction(@NotNull LanguageConsoleView console, @NotNull BaseConsoleExecuteActionHandler executeActionHandler) { this(console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, Conditions.<LanguageConsoleImpl>alwaysTrue()); } - public ConsoleExecuteAction(@NotNull LanguageConsoleView console, @NotNull BaseConsoleExecuteActionHandler executeActionHandler, - @NotNull String emptyExecuteActionId, @NotNull Condition<LanguageConsoleImpl> enabledCondition) { + /** + * Only internal usage, to keep backward compatibility + * to remove in IDEA 14 + */ + public static ConsoleExecuteAction createAction(@NotNull final LanguageConsoleImpl languageConsole, + @NotNull ProcessBackedConsoleExecuteActionHandler consoleExecuteActionHandler) { + final ConsoleExecuteActionHandler handler = consoleExecuteActionHandler; + return new ConsoleExecuteAction(languageConsole, new ConsoleExecuteActionHandler(handler.myPreserveMarkup) { + @Override + void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) { + handler.doExecute(text, languageConsole, null); + } + }, consoleExecuteActionHandler); + } + + ConsoleExecuteAction(@NotNull LanguageConsoleImpl console, final @NotNull ConsoleExecuteActionHandler executeActionHandler, @Nullable Condition<LanguageConsoleImpl> enabledCondition) { + this(console, null, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, enabledCondition); + } + + public ConsoleExecuteAction(@NotNull LanguageConsoleView console, + @NotNull BaseConsoleExecuteActionHandler executeActionHandler, + @Nullable Condition<LanguageConsoleImpl> enabledCondition) { + this(console.getConsole(), console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, enabledCondition); + } + + public ConsoleExecuteAction(@NotNull LanguageConsoleView console, + @NotNull BaseConsoleExecuteActionHandler executeActionHandler, + @NotNull String emptyExecuteActionId, + @NotNull Condition<LanguageConsoleImpl> enabledCondition) { + this(console.getConsole(), console, executeActionHandler, emptyExecuteActionId, enabledCondition); + } + + private ConsoleExecuteAction(@NotNull LanguageConsoleImpl console, + @Nullable LanguageConsoleView consoleView, + @NotNull ConsoleExecuteActionHandler executeActionHandler, + @NotNull String emptyExecuteActionId, + @Nullable Condition<LanguageConsoleImpl> enabledCondition) { super(null, null, AllIcons.Actions.Execute); myConsole = console; + myConsoleView = consoleView; myExecuteActionHandler = executeActionHandler; - myEnabledCondition = enabledCondition; + myEnabledCondition = enabledCondition == null ? Conditions.<LanguageConsoleImpl>alwaysTrue() : enabledCondition; EmptyAction.setupAction(this, emptyExecuteActionId, null); } @Override public final void update(AnActionEvent e) { - EditorEx editor = myConsole.getConsole().getConsoleEditor(); - Lookup lookup = LookupManager.getActiveLookup(editor); - e.getPresentation().setEnabled(!editor.isRendererMode() && isEnabled() && - (lookup == null || !lookup.isCompletion())); + EditorEx editor = myConsole.getConsoleEditor(); + boolean enabled = !editor.isRendererMode() && isEnabled() && + (myExecuteActionHandler.isEmptyCommandExecutionAllowed() || !StringUtil.isEmptyOrSpaces(editor.getDocument().getCharsSequence())); + if (enabled) { + Lookup lookup = LookupManager.getActiveLookup(editor); + enabled = lookup == null || !lookup.isCompletion(); + } + + e.getPresentation().setEnabled(enabled); } @Override public final void actionPerformed(AnActionEvent e) { - myExecuteActionHandler.runExecuteAction(myConsole); + myExecuteActionHandler.runExecuteAction(myConsole, myConsoleView); } protected boolean isEnabled() { - return myEnabledCondition.value(myConsole.getConsole()); + return myEnabledCondition.value(myConsole); + } + + static abstract class ConsoleExecuteActionHandler { + private final ConsoleHistoryModel myConsoleHistoryModel; + + private boolean myAddToHistory = true; + final boolean myPreserveMarkup; + + public ConsoleExecuteActionHandler(boolean preserveMarkup) { + myConsoleHistoryModel = new ConsoleHistoryModel(); + myPreserveMarkup = preserveMarkup; + } + + public ConsoleHistoryModel getConsoleHistoryModel() { + return myConsoleHistoryModel; + } + + public boolean isEmptyCommandExecutionAllowed() { + return true; + } + + public void setAddCurrentToHistory(boolean addCurrentToHistory) { + myAddToHistory = addCurrentToHistory; + } + + final void runExecuteAction(@NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) { + String text = console.prepareExecuteAction(myAddToHistory, myPreserveMarkup, true); + + ((UndoManagerImpl)UndoManager.getInstance(console.getProject())).invalidateActionsFor(DocumentReferenceManager.getInstance().create(console.getCurrentEditor().getDocument())); + + myConsoleHistoryModel.addToHistory(text); + doExecute(text, console, consoleView); + } + + abstract void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView); } }
\ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/execution/console/ConsoleGutterComponent.java b/platform/lang-impl/src/com/intellij/execution/console/ConsoleGutterComponent.java index c6cb0737c857..f7a1d6cc80fd 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/ConsoleGutterComponent.java +++ b/platform/lang-impl/src/com/intellij/execution/console/ConsoleGutterComponent.java @@ -9,6 +9,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.VisualPosition; import com.intellij.openapi.editor.colors.EditorFontType; import com.intellij.openapi.editor.ex.EditorMarkupModel; +import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.ui.HintHint; import com.intellij.ui.JBColor; @@ -25,11 +26,12 @@ import java.awt.event.MouseMotionListener; class ConsoleGutterComponent extends JComponent implements MouseMotionListener { private static final TooltipGroup TOOLTIP_GROUP = new TooltipGroup("CONSOLE_GUTTER_TOOLTIP_GROUP", 0); - private static final int RIGHT_INSET = 6; + + private final EditorImpl editor; private int maxAnnotationWidth = 0; private int myLastPreferredHeight = -1; - private final EditorImpl editor; + private final int lineEndInset; private final GutterContentProvider gutterContentProvider; @@ -41,6 +43,10 @@ class ConsoleGutterComponent extends JComponent implements MouseMotionListener { addListeners(); addMouseMotionListener(this); + + setOpaque(true); + + lineEndInset = EditorUtil.getSpaceWidth(Font.PLAIN, editor); } private void addListeners() { @@ -48,42 +54,45 @@ class ConsoleGutterComponent extends JComponent implements MouseMotionListener { @Override public void mouseClicked(MouseEvent e) { if (!e.isPopupTrigger()) { - gutterContentProvider.doAction(getLineAtPoint(e.getPoint()), editor); + gutterContentProvider.doAction(EditorUtil.yPositionToLogicalLine(editor, e.getPoint()), editor); } } }); } - public void updateSize() { + public void updateSize(int start, int end) { int oldAnnotationsWidth = maxAnnotationWidth; - computeMaxAnnotationWidth(); + computeMaxAnnotationWidth(start, end); if (oldAnnotationsWidth != maxAnnotationWidth || myLastPreferredHeight != editor.getPreferredHeight()) { - fireResized(); + processComponentEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED)); } repaint(); } - private void fireResized() { - processComponentEvent(new ComponentEvent(this, ComponentEvent.COMPONENT_RESIZED)); - } + private void computeMaxAnnotationWidth(int start, int end) { + gutterContentProvider.beforeUiComponentUpdate(editor); - private void computeMaxAnnotationWidth() { if (!gutterContentProvider.hasText()) { maxAnnotationWidth = 0; return; } FontMetrics fontMetrics = editor.getFontMetrics(Font.PLAIN); - int lineCount = editor.getDocument().getLineCount(); - gutterContentProvider.beforeUiComponentUpdate(editor); + int lineCount = Math.min(end, editor.getDocument().getLineCount()); int gutterSize = 0; - for (int i = 0; i < lineCount; i++) { - String text = gutterContentProvider.getText(i, editor); + for (int line = start; line < lineCount; line++) { + String text = gutterContentProvider.getText(line, editor); if (text != null) { gutterSize = Math.max(gutterSize, fontMetrics.stringWidth(text)); } } - maxAnnotationWidth = gutterSize + RIGHT_INSET; + + if (gutterSize != 0) { + gutterSize += lineEndInset; + } + maxAnnotationWidth = Math.max(gutterSize, maxAnnotationWidth); + + editor.getSettings().setAdditionalColumnsCount(1 + (maxAnnotationWidth / EditorUtil.getSpaceWidth(Font.PLAIN, editor))); } @Override @@ -101,9 +110,6 @@ class ConsoleGutterComponent extends JComponent implements MouseMotionListener { return; } - g.setColor(editor.getBackgroundColor()); - g.fillRect(clip.x, clip.y, clip.width, clip.height); - UISettings.setupAntialiasing(g); Graphics2D g2 = (Graphics2D)g; @@ -142,7 +148,7 @@ class ConsoleGutterComponent extends JComponent implements MouseMotionListener { String text = gutterContentProvider.getText(editor.visualToLogicalPosition(new VisualPosition(i, 0)).line, editor); if (text != null) { // right-aligned - g.drawString(text, maxAnnotationWidth - RIGHT_INSET - fontMetrics.stringWidth(text), y); + g.drawString(text, maxAnnotationWidth - lineEndInset - fontMetrics.stringWidth(text), y); } y += lineHeight; } @@ -155,7 +161,7 @@ class ConsoleGutterComponent extends JComponent implements MouseMotionListener { @Override public void mouseMoved(MouseEvent e) { - int line = getLineAtPoint(e.getPoint()); + int line = EditorUtil.yPositionToLogicalLine(editor, e.getPoint()); if (line == lastGutterToolTipLine) { return; } @@ -183,7 +189,7 @@ class ConsoleGutterComponent extends JComponent implements MouseMotionListener { } } - private int getLineAtPoint(@NotNull Point clickPoint) { - return editor.yPositionToLogicalLine(clickPoint.y); + public void documentCleared() { + maxAnnotationWidth = 0; } }
\ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/execution/console/ConsoleIconGutterComponent.java b/platform/lang-impl/src/com/intellij/execution/console/ConsoleIconGutterComponent.java index 144ae3f12fcf..ec57b2108a71 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/ConsoleIconGutterComponent.java +++ b/platform/lang-impl/src/com/intellij/execution/console/ConsoleIconGutterComponent.java @@ -6,6 +6,7 @@ import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.VisualPosition; import com.intellij.openapi.editor.colors.EditorFontType; +import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; @@ -15,7 +16,7 @@ import java.awt.*; import java.awt.event.ComponentEvent; class ConsoleIconGutterComponent extends JComponent { - static final int ICON_AREA_WIDTH = 15; + private final int iconAreaWidth; private int myLastPreferredHeight = -1; private final EditorImpl editor; @@ -25,6 +26,9 @@ class ConsoleIconGutterComponent extends JComponent { public ConsoleIconGutterComponent(@NotNull Editor editor, @NotNull GutterContentProvider provider) { this.editor = (EditorImpl)editor; gutterContentProvider = provider; + + // icon/one-char symbol + space + iconAreaWidth = EditorUtil.getSpaceWidth(Font.PLAIN, editor) * 2; } public void updateSize() { @@ -41,7 +45,7 @@ class ConsoleIconGutterComponent extends JComponent { @Override public Dimension getPreferredSize() { myLastPreferredHeight = editor.getPreferredHeight(); - return new Dimension(ICON_AREA_WIDTH, myLastPreferredHeight); + return new Dimension(iconAreaWidth, myLastPreferredHeight); } @Override @@ -84,8 +88,6 @@ class ConsoleIconGutterComponent extends JComponent { return; } - gutterContentProvider.beforeUiComponentUpdate(editor); - g.setFont(editor.getColorsScheme().getFont(EditorFontType.PLAIN)); int y = ((startLine + 1) * lineHeight) - editor.getDescent(); for (int i = startLine; i < endLine; i++) { diff --git a/platform/lang-impl/src/com/intellij/execution/console/GutterContentProvider.java b/platform/lang-impl/src/com/intellij/execution/console/GutterContentProvider.java index af7d34c0ea59..c283b1a53fdc 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/GutterContentProvider.java +++ b/platform/lang-impl/src/com/intellij/execution/console/GutterContentProvider.java @@ -27,4 +27,8 @@ public abstract class GutterContentProvider { public abstract void doAction(int line, @NotNull Editor editor); public abstract void drawIcon(int line, @NotNull Graphics g, int y, @NotNull Editor editor); + + public boolean isShowSeparatorLine(int line, @NotNull Editor editor) { + return true; + } }
\ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java index 75e4520b6758..0d013fbfec1c 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java +++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java @@ -2,77 +2,169 @@ package com.intellij.execution.console; import com.intellij.execution.process.ProcessHandler; import com.intellij.lang.Language; +import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.VisualPosition; import com.intellij.openapi.editor.colors.EditorColors; import com.intellij.openapi.editor.event.DocumentAdapter; import com.intellij.openapi.editor.event.DocumentEvent; import com.intellij.openapi.editor.ex.DocumentBulkUpdateListener; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.editor.ex.EditorEx; +import com.intellij.openapi.editor.ex.RangeHighlighterEx; +import com.intellij.openapi.editor.impl.EditorComponentImpl; import com.intellij.openapi.editor.impl.EditorImpl; +import com.intellij.openapi.editor.impl.RangeMarkerImpl; +import com.intellij.openapi.editor.impl.event.MarkupModelListener; +import com.intellij.openapi.editor.markup.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Conditions; +import com.intellij.openapi.util.Getter; +import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiFile; +import com.intellij.testFramework.LightVirtualFile; +import com.intellij.ui.components.JBLayeredPane; +import com.intellij.util.Consumer; +import com.intellij.util.PairFunction; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; -public class LanguageConsoleBuilder { - private final LanguageConsoleImpl myConsole; - private LanguageConsoleView myConsoleView; - private Condition<LanguageConsoleImpl> myExecutionEnabled = Conditions.alwaysTrue(); - - public LanguageConsoleBuilder(@NotNull LanguageConsoleView consoleView) { - myConsole = consoleView.getConsole(); - myConsoleView = consoleView; +/** + * @experimental + */ +public final class LanguageConsoleBuilder { + @Nullable + private LanguageConsoleView consoleView; + @Nullable + private Condition<LanguageConsoleImpl> executionEnabled = Conditions.alwaysTrue(); + + @Nullable + private PairFunction<VirtualFile, Project, PsiFile> psiFileFactory; + @Nullable + private BaseConsoleExecuteActionHandler executeActionHandler; + @Nullable + private String historyType; + + @Nullable + private GutterContentProvider gutterContentProvider; + + private boolean oneLineInput; + + // todo to be removed + public LanguageConsoleBuilder(@SuppressWarnings("NullableProblems") @NotNull LanguageConsoleView consoleView) { + this.consoleView = consoleView; } - public LanguageConsoleBuilder(@NotNull Project project, @NotNull Language language) { - myConsole = new MyLanguageConsole(project, language); + public LanguageConsoleBuilder() { } public LanguageConsoleBuilder processHandler(@NotNull ProcessHandler processHandler) { - myExecutionEnabled = new ProcessBackedExecutionEnabledCondition(processHandler); + //noinspection deprecation + executionEnabled = new ProcessBackedExecutionEnabledCondition(processHandler); return this; } public LanguageConsoleBuilder executionEnabled(@NotNull Condition<LanguageConsoleImpl> condition) { - myExecutionEnabled = condition; + executionEnabled = condition; + return this; + } + + /** + * @see {@link com.intellij.psi.PsiCodeFragment} + */ + public LanguageConsoleBuilder psiFileFactory(@NotNull PairFunction<VirtualFile, Project, PsiFile> value) { + psiFileFactory = value; return this; } public LanguageConsoleBuilder initActions(@NotNull BaseConsoleExecuteActionHandler executeActionHandler, @NotNull String historyType) { - ensureConsoleViewCreated(); + if (consoleView == null) { + this.executeActionHandler = executeActionHandler; + this.historyType = historyType; + } + else { + doInitAction(consoleView, executeActionHandler, historyType); + } + return this; + } - ConsoleExecuteAction action = new ConsoleExecuteAction(myConsoleView, executeActionHandler, ConsoleExecuteAction.CONSOLE_EXECUTE_ACTION_ID, myExecutionEnabled); - action.registerCustomShortcutSet(action.getShortcutSet(), myConsole.getConsoleEditor().getComponent()); + private void doInitAction(@NotNull LanguageConsoleView consoleView, @NotNull BaseConsoleExecuteActionHandler executeActionHandler, @NotNull String historyType) { + ConsoleExecuteAction action = new ConsoleExecuteAction(consoleView, executeActionHandler, executionEnabled); + action.registerCustomShortcutSet(action.getShortcutSet(), consoleView.getConsole().getConsoleEditor().getComponent()); - new ConsoleHistoryController(historyType, null, myConsole, executeActionHandler.getConsoleHistoryModel()).install(); - return this; + new ConsoleHistoryController(historyType, null, consoleView.getConsole(), executeActionHandler.getConsoleHistoryModel()).install(); + } + + /** + * todo This API doesn't look good, but it is much better than force client to know low-level details + */ + public static Pair<AnAction, ConsoleHistoryController> registerExecuteAction(@NotNull LanguageConsoleImpl console, + @NotNull final Consumer<String> executeActionHandler, + @NotNull String historyType, + @Nullable String historyPersistenceId, + @Nullable Condition<LanguageConsoleImpl> enabledCondition) { + ConsoleExecuteAction.ConsoleExecuteActionHandler handler = new ConsoleExecuteAction.ConsoleExecuteActionHandler(true) { + @Override + void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) { + executeActionHandler.consume(text); + } + }; + + ConsoleExecuteAction action = new ConsoleExecuteAction(console, handler, enabledCondition); + action.registerCustomShortcutSet(action.getShortcutSet(), console.getConsoleEditor().getComponent()); + + ConsoleHistoryController historyController = new ConsoleHistoryController(historyType, historyPersistenceId, console, handler.getConsoleHistoryModel()); + historyController.install(); + return new Pair<AnAction, ConsoleHistoryController>(action, historyController); } - public LanguageConsoleBuilder historyAnnotation(@Nullable GutterContentProvider provider) { - ((MyLanguageConsole)myConsole).gutterContentProvider = provider; + public LanguageConsoleBuilder gutterContentProvider(@Nullable GutterContentProvider value) { + gutterContentProvider = value; return this; } - private void ensureConsoleViewCreated() { - if (myConsoleView == null) { - myConsoleView = new LanguageConsoleViewImpl(myConsole, true); - } + /** + * @see {@link com.intellij.openapi.editor.ex.EditorEx#setOneLineMode(boolean)} + */ + public LanguageConsoleBuilder oneLineInput() { + oneLineInput(true); + return this; } - public LanguageConsoleView build() { - myConsole.setShowSeparatorLine(false); - myConsole.initComponents(); + /** + * @see {@link com.intellij.openapi.editor.ex.EditorEx#setOneLineMode(boolean)} + */ + public LanguageConsoleBuilder oneLineInput(boolean value) { + oneLineInput = value; + return this; + } - ensureConsoleViewCreated(); - return myConsoleView; + public LanguageConsoleView build(@NotNull Project project, @NotNull Language language) { + GutteredLanguageConsole console = new GutteredLanguageConsole(project, language, gutterContentProvider, psiFileFactory); + LanguageConsoleViewImpl consoleView = new LanguageConsoleViewImpl(console, true); + if (executeActionHandler != null) { + assert historyType != null; + doInitAction(consoleView, executeActionHandler, historyType); + } + if (oneLineInput) { + console.getConsoleEditor().setOneLineMode(true); + } + console.initComponents(); + return consoleView; } + @Deprecated + /** + * @deprecated Don't use it directly! + * Will be private in IDEA >13 + */ public static class ProcessBackedExecutionEnabledCondition implements Condition<LanguageConsoleImpl> { private final ProcessHandler myProcessHandler; @@ -86,113 +178,405 @@ public class LanguageConsoleBuilder { } } - private static class GutteredEditorPanel extends JPanel { - private final EditorEx editor; + private final static class GutteredLanguageConsole extends LanguageConsoleImpl { + @Nullable + private final GutterContentProvider gutterContentProvider; + @Nullable + private final PairFunction<VirtualFile, Project, PsiFile> psiFileFactory; - public GutteredEditorPanel(EditorEx editor) { - super(new BorderLayout()); + public GutteredLanguageConsole(@NotNull Project project, + @NotNull Language language, + @Nullable GutterContentProvider gutterContentProvider, + @Nullable PairFunction<VirtualFile, Project, PsiFile> psiFileFactory) { + super(project, language.getDisplayName() + " Console", language, false); - this.editor = editor; + setShowSeparatorLine(false); + + this.gutterContentProvider = gutterContentProvider; + this.psiFileFactory = psiFileFactory; } @Override - public void paint(Graphics g) { - super.paint(g); - - Rectangle clip = g.getClipBounds(); - if (clip.height < 0) { - return; - } + boolean isHistoryViewerForceAdditionalColumnsUsage() { + return gutterContentProvider == null; + } - int lineHeight = editor.getLineHeight(); - int startLine = clip.y / lineHeight; - int endLine = Math.min(((clip.y + clip.height) / lineHeight) + 1, ((EditorImpl)editor).getVisibleLineCount()); - if (startLine >= endLine) { - return; + @NotNull + @Override + protected PsiFile createFile(@NotNull LightVirtualFile virtualFile, @NotNull Document document, @NotNull Project project) { + if (psiFileFactory == null) { + return super.createFile(virtualFile, document, project); } - - int y = ((startLine + 1) * lineHeight); - g.setColor(editor.getColorsScheme().getColor(EditorColors.INDENT_GUIDE_COLOR)); - for (int i = startLine; i < endLine; i++) { - g.drawLine(ConsoleIconGutterComponent.ICON_AREA_WIDTH, y, clip.width, y); - y += lineHeight; + else { + return psiFileFactory.fun(virtualFile, project); } } - } - - private static class MyLanguageConsole extends LanguageConsoleImpl { - @Nullable - private GutterContentProvider gutterContentProvider; - - public MyLanguageConsole(@NotNull Project project, @NotNull Language language) { - super(project, language.getDisplayName() + " Console", language, false); - } @Override protected void setupEditorDefault(@NotNull EditorEx editor) { super.setupEditorDefault(editor); if (editor == getConsoleEditor()) { - // todo consider to fix platform - editor.getSettings().setAdditionalLinesCount(1); + editor.setOneLineMode(true); + return; } - else if (gutterContentProvider != null) { - JScrollPane scrollPane = editor.getScrollPane(); - JPanel panel = new GutteredEditorPanel(editor); + else if (gutterContentProvider == null) { + return; + } + + final ConsoleIconGutterComponent lineStartGutter = new ConsoleIconGutterComponent(editor, gutterContentProvider); + final ConsoleGutterComponent lineEndGutter = new ConsoleGutterComponent(editor, gutterContentProvider); + JLayeredPane layeredPane = new JBLayeredPane() { + @Override + public Dimension getPreferredSize() { + Dimension editorSize = getEditorComponent().getPreferredSize(); + return new Dimension(lineStartGutter.getPreferredSize().width + editorSize.width, editorSize.height); + } + + @Override + public Dimension getMinimumSize() { + Dimension editorSize = getEditorComponent().getMinimumSize(); + return new Dimension(lineStartGutter.getPreferredSize().width + editorSize.width, editorSize.height); + } + + @Override + public void doLayout() { + EditorComponentImpl editor = getEditorComponent(); + int w = getWidth(); + int h = getHeight(); + int lineStartGutterWidth = lineStartGutter.getPreferredSize().width; + lineStartGutter.setBounds(0, 0, lineStartGutterWidth, h); + + editor.setBounds(lineStartGutterWidth, 0, w - lineStartGutterWidth, h); + + int lineEndGutterWidth = lineEndGutter.getPreferredSize().width; + lineEndGutter.setBounds(lineStartGutterWidth + (w - lineEndGutterWidth - editor.getEditor().getScrollPane().getVerticalScrollBar().getWidth()), 0, lineEndGutterWidth, h); + } + + @NotNull + private EditorComponentImpl getEditorComponent() { + for (int i = getComponentCount() - 1; i >= 0; i--) { + Component component = getComponent(i); + if (component instanceof EditorComponentImpl) { + return (EditorComponentImpl)component; + } + } + throw new IllegalStateException(); + } + }; + + layeredPane.add(lineStartGutter, JLayeredPane.DEFAULT_LAYER); + + JScrollPane scrollPane = editor.getScrollPane(); + layeredPane.add(scrollPane.getViewport().getView(), JLayeredPane.DEFAULT_LAYER); + + layeredPane.add(lineEndGutter, JLayeredPane.PALETTE_LAYER); + + scrollPane.setViewportView(layeredPane); + + GutterUpdateScheduler gutterUpdateScheduler = new GutterUpdateScheduler(lineStartGutter, lineEndGutter); + getProject().getMessageBus().connect(this).subscribe(DocumentBulkUpdateListener.TOPIC, gutterUpdateScheduler); + editor.getDocument().addDocumentListener(gutterUpdateScheduler); + } - final ConsoleIconGutterComponent lineStartGutter = new ConsoleIconGutterComponent(editor, gutterContentProvider); - panel.add(lineStartGutter, BorderLayout.LINE_START); + @Override + protected void doAddPromptToHistory() { + if (gutterContentProvider == null) { + super.doAddPromptToHistory(); + } + else { + gutterContentProvider.beforeEvaluate(getHistoryViewer()); + } + } - panel.add(scrollPane.getViewport().getView(), BorderLayout.CENTER); + private final class GutterUpdateScheduler extends DocumentAdapter implements DocumentBulkUpdateListener { + private final ConsoleIconGutterComponent lineStartGutter; + private final ConsoleGutterComponent lineEndGutter; - final ConsoleGutterComponent lineEndGutter = new ConsoleGutterComponent(editor, gutterContentProvider); - panel.add(lineEndGutter, BorderLayout.LINE_END); + private Task gutterSizeUpdater; + private RangeHighlighterEx lineSeparatorPainter; - scrollPane.setViewportView(panel); + public GutterUpdateScheduler(@NotNull ConsoleIconGutterComponent lineStartGutter, @NotNull ConsoleGutterComponent lineEndGutter) { + this.lineStartGutter = lineStartGutter; + this.lineEndGutter = lineEndGutter; - getProject().getMessageBus().connect(this).subscribe(DocumentBulkUpdateListener.TOPIC, new DocumentBulkUpdateListener.Adapter() { + // console view can invoke markupModel.removeAllHighlighters(), so, we must be aware of it + getHistoryViewer().getMarkupModel().addMarkupModelListener(GutteredLanguageConsole.this, new MarkupModelListener.Adapter() { @Override - public void updateFinished(@NotNull Document document) { - if (document.getTextLength() == 0) { - gutterContentProvider.documentCleared(getHistoryViewer()); + public void beforeRemoved(@NotNull RangeHighlighterEx highlighter) { + if (lineSeparatorPainter == highlighter) { + lineSeparatorPainter = null; } - lineStartGutter.updateSize(); - lineEndGutter.updateSize(); } }); + } - editor.getDocument().addDocumentListener(new DocumentAdapter() { - @Override - public void documentChanged(DocumentEvent event) { - EditorEx editor = getHistoryViewer(); - DocumentEx document = editor.getDocument(); - if (document.isInBulkUpdate()) { - return; - } + private void addLineSeparatorPainterIfNeed() { + if (lineSeparatorPainter != null) { + return; + } - if (document.getTextLength() > 0) { - int startDocLine = document.getLineNumber(event.getOffset()); - int endDocLine = document.getLineNumber(event.getOffset() + event.getNewLength()); - if (event.getOldLength() > event.getNewLength() || startDocLine != endDocLine || StringUtil.indexOf(event.getOldFragment(), '\n') != -1) { - lineStartGutter.updateSize(); - lineEndGutter.updateSize(); - } - } - else if (event.getOldLength() > 0) { - gutterContentProvider.documentCleared(editor); - } + EditorEx editor = getHistoryViewer(); + int endOffset = getDocument().getTextLength(); + lineSeparatorPainter = new LineSeparatorPainter(editor, endOffset); + editor.getMarkupModel().addRangeHighlighter(lineSeparatorPainter, 0, endOffset, false, false, HighlighterLayer.ADDITIONAL_SYNTAX); + } + + private DocumentEx getDocument() { + return getHistoryViewer().getDocument(); + } + + @Override + public void documentChanged(DocumentEvent event) { + DocumentEx document = getDocument(); + if (document.isInBulkUpdate()) { + return; + } + + if (document.getTextLength() > 0) { + addLineSeparatorPainterIfNeed(); + int startDocLine = document.getLineNumber(event.getOffset()); + int endDocLine = document.getLineNumber(event.getOffset() + event.getNewLength()); + if (event.getOldLength() > event.getNewLength() || startDocLine != endDocLine || StringUtil.indexOf(event.getOldFragment(), '\n') != -1) { + updateGutterSize(startDocLine, endDocLine); } - }); + } + else if (event.getOldLength() > 0) { + documentCleared(); + } + } + + private void documentCleared() { + gutterSizeUpdater = null; + + lineEndGutter.documentCleared(); + + assert gutterContentProvider != null; + gutterContentProvider.documentCleared(getHistoryViewer()); + } + + @Override + public void updateStarted(@NotNull Document document) { + } + + @Override + public void updateFinished(@NotNull Document document) { + if (getDocument().getTextLength() == 0) { + documentCleared(); + } + else { + addLineSeparatorPainterIfNeed(); + updateGutterSize(0, Integer.MAX_VALUE); + } + } + + private void updateGutterSize(int start, int end) { + if (gutterSizeUpdater != null) { + gutterSizeUpdater.start = Math.min(start, gutterSizeUpdater.start); + gutterSizeUpdater.end = Math.max(end, gutterSizeUpdater.end); + return; + } + + gutterSizeUpdater = new Task(start, end); + SwingUtilities.invokeLater(gutterSizeUpdater); + } + + private final class Task implements Runnable { + private int start; + private int end; + + public Task(int start, int end) { + this.start = start; + this.end = end; + } + + @Override + public void run() { + if (!getHistoryViewer().isDisposed()) { + lineStartGutter.updateSize(); + lineEndGutter.updateSize(start, end); + } + gutterSizeUpdater = null; + } } } - @Override - protected void doAddPromptToHistory() { - if (gutterContentProvider == null) { - super.doAddPromptToHistory(); + private final class LineSeparatorPainter extends RangeMarkerImpl implements RangeHighlighterEx, Getter<RangeHighlighterEx> { + private final CustomHighlighterRenderer renderer = new CustomHighlighterRenderer() { + @Override + public void paint(@NotNull Editor editor, @NotNull RangeHighlighter highlighter, @NotNull Graphics g) { + Rectangle clip = g.getClipBounds(); + int lineHeight = editor.getLineHeight(); + int startLine = clip.y / lineHeight; + int endLine = Math.min(((clip.y + clip.height) / lineHeight) + 1, ((EditorImpl)editor).getVisibleLineCount()); + if (startLine >= endLine) { + return; + } + + // workaround - editor ask us to paint line 4-6, but we should draw line for line 3 (startLine - 1) also, otherwise it will be not rendered + int actualStartLine = startLine == 0 ? 0 : startLine - 1; + int y = (actualStartLine + 1) * lineHeight; + g.setColor(editor.getColorsScheme().getColor(EditorColors.INDENT_GUIDE_COLOR)); + assert gutterContentProvider != null; + for (int visualLine = actualStartLine; visualLine < endLine; visualLine++) { + if (gutterContentProvider.isShowSeparatorLine(editor.visualToLogicalPosition(new VisualPosition(visualLine, 0)).line, editor)) { + g.drawLine(0, y, clip.width, y); + } + y += lineHeight; + } + } + }; + + public LineSeparatorPainter(@NotNull EditorEx editor, int endOffset) { + super(editor.getDocument(), 0, endOffset, false); } - else { - gutterContentProvider.beforeEvaluate(getHistoryViewer()); + + @Override + protected void changedUpdateImpl(DocumentEvent e) { + setIntervalEnd(myDocument.getTextLength()); + } + + @Override + public boolean setValid(boolean value) { + return super.setValid(value); + } + + @Override + public boolean isAfterEndOfLine() { + return false; + } + + @Override + public void setAfterEndOfLine(boolean value) { + } + + @Override + public int getAffectedAreaStartOffset() { + return 0; + } + + @Override + public int getAffectedAreaEndOffset() { + return myDocument.getTextLength(); + } + + @Override + public void setTextAttributes(@NotNull TextAttributes textAttributes) { + } + + @NotNull + @Override + public HighlighterTargetArea getTargetArea() { + return HighlighterTargetArea.EXACT_RANGE; + } + + @Nullable + @Override + public TextAttributes getTextAttributes() { + return null; + } + + @Nullable + @Override + public LineMarkerRenderer getLineMarkerRenderer() { + return null; + } + + @Override + public void setLineMarkerRenderer(@Nullable LineMarkerRenderer renderer) { + } + + @Nullable + @Override + public CustomHighlighterRenderer getCustomRenderer() { + return renderer; + } + + @Override + public void setCustomRenderer(CustomHighlighterRenderer renderer) { + } + + @Nullable + @Override + public GutterIconRenderer getGutterIconRenderer() { + return null; + } + + @Override + public void setGutterIconRenderer(@Nullable GutterIconRenderer renderer) { + } + + @Nullable + @Override + public Color getErrorStripeMarkColor() { + return null; + } + + @Override + public void setErrorStripeMarkColor(@Nullable Color color) { + } + + @Nullable + @Override + public Object getErrorStripeTooltip() { + return null; + } + + @Override + public void setErrorStripeTooltip(@Nullable Object tooltipObject) { + } + + @Override + public boolean isThinErrorStripeMark() { + return false; + } + + @Override + public void setThinErrorStripeMark(boolean value) { + } + + @Nullable + @Override + public Color getLineSeparatorColor() { + return null; + } + + @Override + public void setLineSeparatorColor(@Nullable Color color) { + } + + @Override + public void setLineSeparatorRenderer(LineSeparatorRenderer renderer) { + } + + @Override + public LineSeparatorRenderer getLineSeparatorRenderer() { + return null; + } + + @Nullable + @Override + public SeparatorPlacement getLineSeparatorPlacement() { + return null; + } + + @Override + public void setLineSeparatorPlacement(@Nullable SeparatorPlacement placement) { + } + + @Override + public void setEditorFilter(@NotNull MarkupEditorFilter filter) { + } + + @NotNull + @Override + public MarkupEditorFilter getEditorFilter() { + return MarkupEditorFilter.EMPTY; + } + + @Override + public RangeHighlighterEx get() { + return this; } } } diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java index fed2716b32b1..da38faf0f8f5 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java @@ -27,13 +27,10 @@ import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.actions.EditorActionUtil; import com.intellij.openapi.editor.colors.EditorColors; import com.intellij.openapi.editor.colors.EditorColorsManager; -import com.intellij.openapi.editor.colors.EditorColorsScheme; -import com.intellij.openapi.editor.colors.impl.DelegateColorScheme; import com.intellij.openapi.editor.event.*; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.editor.ex.FocusChangeListener; @@ -46,11 +43,11 @@ import com.intellij.openapi.editor.impl.DocumentMarkupModel; import com.intellij.openapi.editor.impl.EditorFactoryImpl; import com.intellij.openapi.editor.markup.*; import com.intellij.openapi.fileEditor.*; +import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx; import com.intellij.openapi.fileEditor.impl.FileEditorManagerImpl; import com.intellij.openapi.fileTypes.FileTypes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.Computable; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.util.text.StringUtilRt; @@ -61,6 +58,7 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.testFramework.LightVirtualFile; import com.intellij.ui.JBColor; import com.intellij.ui.SideBorder; +import com.intellij.util.DocumentUtil; import com.intellij.util.FileContentUtil; import com.intellij.util.ObjectUtils; import com.intellij.util.SingleAlarm; @@ -165,20 +163,11 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } public void initComponents() { - final EditorColorsScheme colorsScheme = myConsoleEditor.getColorsScheme(); - final DelegateColorScheme scheme = new DelegateColorScheme(colorsScheme) { - @NotNull - @Override - public Color getDefaultBackground() { - final Color color = getColor(ConsoleViewContentType.CONSOLE_BACKGROUND_KEY); - return color == null ? super.getDefaultBackground() : color; - } - }; - myConsoleEditor.setColorsScheme(scheme); - myHistoryViewer.setColorsScheme(scheme); + setupComponents(); + myPanel.add(myHistoryViewer.getComponent()); myPanel.add(myConsoleEditor.getComponent()); - setupComponents(); + DataManager.registerDataProvider(myPanel, new TypeSafeDataProviderAdapter(this)); myHistoryViewer.getComponent().addComponentListener(new ComponentAdapter() { @@ -226,7 +215,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { setupEditorDefault(myConsoleEditor); setupEditorDefault(myHistoryViewer); - //noinspection PointlessBooleanExpression,ConstantConditions + //noinspection ConstantConditions if (SEPARATOR_THICKNESS > 0 && myShowSeparatorLine) { myHistoryViewer.getComponent().setBorder(new SideBorder(JBColor.LIGHT_GRAY, SideBorder.BOTTOM)); } @@ -235,9 +224,9 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { myHistoryViewer.setCaretEnabled(false); myConsoleEditor.addEditorMouseListener(EditorActionUtil.createEditorPopupHandler(IdeActions.GROUP_CONSOLE_EDITOR_POPUP)); - myConsoleEditor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(myProject, myVirtualFile)); + myConsoleEditor.setHighlighter(EditorHighlighterFactory.getInstance().createEditorHighlighter(myVirtualFile, myConsoleEditor.getColorsScheme(), myProject)); - final VisibleAreaListener areaListener = new VisibleAreaListener() { + myConsoleEditor.getScrollingModel().addVisibleAreaListener(new VisibleAreaListener() { @Override public void visibleAreaChanged(VisibleAreaEvent e) { final int offset = myConsoleEditor.getScrollingModel().getHorizontalScrollOffset(); @@ -253,8 +242,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } } } - }; - myConsoleEditor.getScrollingModel().addVisibleAreaListener(areaListener); + }); final DocumentAdapter docListener = new DocumentAdapter() { @Override public void documentChanged(final DocumentEvent e) { @@ -273,6 +261,8 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } } }); + + //noinspection deprecation for (AnAction action : createActions()) { action.registerCustomShortcutSet(action.getShortcutSet(), myConsoleEditor.getComponent()); } @@ -284,18 +274,22 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } @NotNull + @Deprecated + /** + * @deprecated LanguageConsoleImpl is not intended to be extended + */ protected AnAction[] createActions() { return AnAction.EMPTY_ARRAY; } - public void setTextToEditor(@NotNull final String text) { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - myConsoleEditor.getDocument().setText(text); - } - }); - queueUiUpdate(true); + @SuppressWarnings("UnusedDeclaration") + @Deprecated + /** + * @deprecated Use {@link #setInputText} + * to remove in IDEA 15 + */ + public void setTextToEditor(@NotNull String text) { + setInputText(text); } protected void setupEditorDefault(@NotNull EditorEx editor) { @@ -306,9 +300,10 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { editor.setBorder(null); final EditorSettings editorSettings = editor.getSettings(); - editorSettings.setAdditionalLinesCount(myHistoryViewer == editor ? 0 : 2); + if (myHistoryViewer != editor) { + editorSettings.setAdditionalLinesCount(1); + } editorSettings.setAdditionalColumnsCount(1); - editorSettings.setRightMarginShown(false); } public void setUiUpdateRunnable(Runnable uiUpdateRunnable) { @@ -414,11 +409,20 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } Document history = myHistoryViewer.getDocument(); - MarkupModel markupModel = DocumentMarkupModel.forDocument(history, myProject, true); int offset = appendToHistoryDocument(history, text); - markupModel.addRangeHighlighter(offset, offset + text.length(), HighlighterLayer.SYNTAX, attributes, HighlighterTargetArea.EXACT_RANGE); + DocumentMarkupModel.forDocument(history, myProject, true).addRangeHighlighter(offset, offset + text.length(), HighlighterLayer.SYNTAX, attributes, + HighlighterTargetArea.EXACT_RANGE); } + @SuppressWarnings("UnusedDeclaration") + @Deprecated + /** + * @deprecated Use {@link LanguageConsoleBuilder}, + * {@link LanguageConsoleBuilder#registerExecuteAction)} or + * {@link ConsoleExecuteAction#prepareRunExecuteAction)} + * + * to remove in IDEA 15 + */ public String addCurrentToHistory(@NotNull TextRange textRange, boolean erase, boolean preserveMarkup) { return addToHistoryInner(textRange, myConsoleEditor, erase, preserveMarkup); } @@ -428,20 +432,36 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } @NotNull + public String prepareExecuteAction(boolean addToHistory, boolean preserveMarkup, boolean clearInput) { + Editor editor = getCurrentEditor(); + Document document = editor.getDocument(); + String text = document.getText(); + TextRange range = new TextRange(0, document.getTextLength()); + if (!clearInput) { + editor.getSelectionModel().setSelection(range.getStartOffset(), range.getEndOffset()); + } + + if (addToHistory) { + addToHistoryInner(range, myConsoleEditor, clearInput, preserveMarkup); + } + else if (clearInput) { + setInputText(""); + } + return text; + } + + @NotNull protected String addToHistoryInner(@NotNull final TextRange textRange, @NotNull final EditorEx editor, boolean erase, final boolean preserveMarkup) { - String result = ApplicationManager.getApplication().runReadAction(new Computable<String>() { - @Override - public String compute() { - return addTextRangeToHistory(textRange, editor, preserveMarkup); - } - }); + ApplicationManager.getApplication().assertIsDispatchThread(); + + String result = addTextRangeToHistory(textRange, editor, preserveMarkup); if (erase) { - new WriteCommandAction.Simple(myProject, myFile) { + DocumentUtil.writeInRunUndoTransparentAction(new Runnable() { @Override - protected void run() throws Throwable { + public void run() { editor.getDocument().deleteString(textRange.getStartOffset(), textRange.getEndOffset()); } - }.execute(); + }); } // always scroll to end on user input scrollHistoryToEnd(); @@ -466,19 +486,16 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { @NotNull protected String addTextRangeToHistory(@NotNull TextRange textRange, @NotNull EditorEx consoleEditor, boolean preserveMarkup) { + doAddPromptToHistory(); + final Document history = myHistoryViewer.getDocument(); final MarkupModel markupModel = DocumentMarkupModel.forDocument(history, myProject, true); - doAddPromptToHistory(); final int localStartOffset = textRange.getStartOffset(); String text; EditorHighlighter highlighter; if (consoleEditor instanceof EditorWindow) { - EditorWindow editorWindow = (EditorWindow)consoleEditor; - EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); - PsiFile file = editorWindow.getInjectedFile(); - final VirtualFile virtualFile = file.getVirtualFile(); - assert virtualFile != null; - highlighter = HighlighterFactory.createHighlighter(virtualFile, scheme, getProject()); + PsiFile file = ((EditorWindow)consoleEditor).getInjectedFile(); + highlighter = HighlighterFactory.createHighlighter(file.getVirtualFile(), EditorColorsManager.getInstance().getGlobalScheme(), getProject()); String fullText = InjectedLanguageUtil.getUnescapedText(file, null, null); highlighter.setText(fullText); text = textRange.substring(fullText); @@ -494,7 +511,9 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { final int localEndOffset = textRange.getEndOffset(); while (!iterator.atEnd()) { final int itStart = iterator.getStart(); - if (itStart > localEndOffset) break; + if (itStart > localEndOffset) { + break; + } final int itEnd = iterator.getEnd(); if (itEnd >= localStartOffset) { final int start = Math.max(itStart, localStartOffset) - localStartOffset + offset; @@ -528,19 +547,26 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { private static void duplicateHighlighters(@NotNull MarkupModel to, @NotNull MarkupModel from, int offset, @NotNull TextRange textRange) { for (RangeHighlighter rangeHighlighter : from.getAllHighlighters()) { - if (!rangeHighlighter.isValid()) continue; + if (!rangeHighlighter.isValid()) { + continue; + } Object tooltip = rangeHighlighter.getErrorStripeTooltip(); HighlightInfo highlightInfo = tooltip instanceof HighlightInfo? (HighlightInfo)tooltip : null; if (highlightInfo != null) { - if (highlightInfo.getSeverity() != HighlightSeverity.INFORMATION) continue; - if (highlightInfo.type.getAttributesKey() == EditorColors.IDENTIFIER_UNDER_CARET_ATTRIBUTES) continue; + if (highlightInfo.getSeverity() != HighlightSeverity.INFORMATION) { + continue; + } + if (highlightInfo.type.getAttributesKey() == EditorColors.IDENTIFIER_UNDER_CARET_ATTRIBUTES) { + continue; + } } final int localOffset = textRange.getStartOffset(); final int start = Math.max(rangeHighlighter.getStartOffset(), localOffset) - localOffset; final int end = Math.min(rangeHighlighter.getEndOffset(), textRange.getEndOffset()) - localOffset; - if (start > end) continue; - final RangeHighlighter h = to.addRangeHighlighter( - start + offset, end + offset, rangeHighlighter.getLayer(), rangeHighlighter.getTextAttributes(), rangeHighlighter.getTargetArea()); + if (start > end) { + continue; + } + final RangeHighlighter h = to.addRangeHighlighter(start + offset, end + offset, rangeHighlighter.getLayer(), rangeHighlighter.getTextAttributes(), rangeHighlighter.getTargetArea()); ((RangeHighlighterEx)h).setAfterEndOfLine(((RangeHighlighterEx)rangeHighlighter).isAfterEndOfLine()); } } @@ -562,8 +588,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { editorFactory.releaseEditor(myHistoryViewer); final FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); - final boolean isOpen = editorManager.isFileOpen(myVirtualFile); - if (isOpen) { + if (editorManager.isFileOpen(myVirtualFile)) { editorManager.closeFile(myVirtualFile); } } @@ -574,14 +599,12 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { sink.put(OpenFileDescriptor.NAVIGATE_IN_EDITOR, myConsoleEditor); } else if (getProject().isInitialized()) { - FileEditorManager editorManager = FileEditorManager.getInstance(getProject()); - final Object o = ((FileEditorManagerImpl)editorManager).getData(key.getName(), myConsoleEditor, myVirtualFile); - sink.put(key, o); + sink.put(key, FileEditorManagerEx.getInstanceEx(getProject()).getData(key.getName(), myConsoleEditor, myVirtualFile)); } } private void installEditorFactoryListener() { - final FileEditorManagerAdapter fileEditorListener = new FileEditorManagerAdapter() { + FileEditorManagerAdapter fileEditorListener = new FileEditorManagerAdapter() { @Override public void fileOpened(@NotNull FileEditorManager source, @NotNull VirtualFile file) { if (myConsoleEditor == null || !Comparing.equal(file, myVirtualFile)) { @@ -612,9 +635,13 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { @Override public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) { - if (!Comparing.equal(file, myVirtualFile)) return; + if (!Comparing.equal(file, myVirtualFile)) { + return; + } if (myUiUpdateRunnable != null && !Boolean.TRUE.equals(file.getUserData(FileEditorManagerImpl.CLOSING_TO_REOPEN))) { - if (myCurrentEditor != null && myCurrentEditor.isDisposed()) myCurrentEditor = null; + if (myCurrentEditor != null && myCurrentEditor.isDisposed()) { + myCurrentEditor = null; + } ApplicationManager.getApplication().runReadAction(myUiUpdateRunnable); } } @@ -627,7 +654,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } public Editor getCurrentEditor() { - return myCurrentEditor == null? myConsoleEditor : myCurrentEditor; + return ObjectUtils.chooseNotNull(myCurrentEditor, myConsoleEditor); } public Language getLanguage() { @@ -642,7 +669,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { } public void setInputText(@NotNull final String query) { - ApplicationManager.getApplication().runWriteAction(new Runnable() { + DocumentUtil.writeInRunUndoTransparentAction(new Runnable() { @Override public void run() { myConsoleEditor.getDocument().setText(query); @@ -655,6 +682,10 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { return ObjectUtils.assertNotNull(PsiManager.getInstance(project).findFile(virtualFile)); } + boolean isHistoryViewerForceAdditionalColumnsUsage() { + return true; + } + private class MyLayout extends AbstractLayoutManager { @Override public Dimension preferredLayoutSize(final Container parent) { @@ -686,9 +717,11 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider { // deal with width final int width = Math.max(editorSize.width, historySize.width); newEditorSize.width = width + editor.getScrollPane().getHorizontalScrollBar().getHeight(); - history.getSoftWrapModel().forceAdditionalColumnsUsage(); - editor.getSettings().setAdditionalColumnsCount(2 + (width - editorSize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, editor)); - history.getSettings().setAdditionalColumnsCount(2 + (width - historySize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, history)); + if (isHistoryViewerForceAdditionalColumnsUsage()) { + history.getSoftWrapModel().forceAdditionalColumnsUsage(); + editor.getSettings().setAdditionalColumnsCount(2 + (width - editorSize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, editor)); + history.getSettings().setAdditionalColumnsCount(2 + (width - historySize.width) / EditorUtil.getSpaceWidth(Font.PLAIN, history)); + } // deal with height if (historySize.width == 0) { diff --git a/platform/lang-impl/src/com/intellij/execution/console/ProcessBackedConsoleExecuteActionHandler.java b/platform/lang-impl/src/com/intellij/execution/console/ProcessBackedConsoleExecuteActionHandler.java new file mode 100644 index 000000000000..2c957a4ed2da --- /dev/null +++ b/platform/lang-impl/src/com/intellij/execution/console/ProcessBackedConsoleExecuteActionHandler.java @@ -0,0 +1,80 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.console; + +import com.intellij.execution.process.BaseOSProcessHandler; +import com.intellij.execution.process.ProcessHandler; +import com.intellij.openapi.util.Condition; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.Charset; + +/** + * @author traff + */ +public class ProcessBackedConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler implements Condition<LanguageConsoleImpl> { + private volatile ProcessHandler myProcessHandler; + + public ProcessBackedConsoleExecuteActionHandler(ProcessHandler processHandler, boolean preserveMarkup) { + super(preserveMarkup); + + myProcessHandler = processHandler; + } + + public void setProcessHandler(@NotNull ProcessHandler processHandler) { + myProcessHandler = processHandler; + } + + @SuppressWarnings("deprecation") + @Override + @Deprecated + /** + * @deprecated to remove in IDEA 15 + */ + protected void execute(@NotNull String text) { + processLine(text); + } + + public void processLine(@NotNull String line) { + sendText(line + "\n"); + } + + public void sendText(String line) { + final Charset charset = myProcessHandler instanceof BaseOSProcessHandler ? + ((BaseOSProcessHandler)myProcessHandler).getCharset() : null; + final OutputStream outputStream = myProcessHandler.getProcessInput(); + assert outputStream != null : "output stream is null"; + try { + byte[] bytes = charset != null ? (line + "\n").getBytes(charset) : line.getBytes(); + outputStream.write(bytes); + outputStream.flush(); + } + catch (IOException ignored) { + } + } + + public final boolean isProcessTerminated() { + final ProcessHandler handler = myProcessHandler; + return handler == null || handler.isProcessTerminated(); + } + + @Override + public boolean value(LanguageConsoleImpl console) { + return !isProcessTerminated(); + } +}
\ No newline at end of file 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 9eed96f00cda..f729219a5389 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java @@ -16,6 +16,7 @@ package com.intellij.execution.impl; +import com.google.common.base.CharMatcher; import com.intellij.codeInsight.navigation.IncrementalSearchHandler; import com.intellij.codeInsight.template.impl.editorActions.TypedActionHandlerBase; import com.intellij.execution.ConsoleFolding; @@ -91,6 +92,8 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo private static final int DEFAULT_FLUSH_DELAY = SystemProperties.getIntProperty("console.flush.delay.ms", 200); + private static final CharMatcher NEW_LINE_MATCHER = CharMatcher.anyOf("\n\r"); + public static final Key<ConsoleViewImpl> CONSOLE_VIEW_IN_EDITOR_VIEW = Key.create("CONSOLE_VIEW_IN_EDITOR_VIEW"); static { @@ -107,7 +110,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo private ConsoleState myState; - private final Alarm mySpareTimeAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD, this); + private final Alarm mySpareTimeAlarm = new Alarm(this); @Nullable private final Alarm myHeavyAlarm; private int myHeavyUpdateTicket; @@ -465,6 +468,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo if (myEditor == null) { myEditor = createEditor(); + registerConsoleEditorActions(); myEditor.getScrollPane().setBorder(null); myHyperlinks = new EditorHyperlinkSupport(myEditor, myProject); requestFlushImmediately(); @@ -553,10 +557,8 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo s = pair.first; myContentSize += s.length() - pair.second; - if (s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0) { - if (contentType == ConsoleViewContentType.USER_INPUT) { - flushDeferredUserInput(); - } + if (contentType == ConsoleViewContentType.USER_INPUT && NEW_LINE_MATCHER.indexIn(s) >= 0) { + flushDeferredUserInput(); } if (myEditor != null && !myFlushAlarm.isDisposed()) { final boolean shouldFlushNow = myBuffer.isUseCyclicBuffer() && myBuffer.getLength() >= myBuffer.getCyclicBufferSize(); @@ -859,9 +861,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo editor.getSettings().setAllowSingleLogicalLineFolding(true); // We want to fold long soft-wrapped command lines editor.setHighlighter(createHighlighter()); - if (!myIsViewer) { - registerConsoleEditorActions(editor); - } return editor; } }); @@ -899,11 +898,17 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo return new MyHighlighter(); } - private static void registerConsoleEditorActions(Editor editor) { - new EnterHandler().registerCustomShortcutSet(CommonShortcuts.ENTER, editor.getContentComponent()); - registerActionHandler(editor, IdeActions.ACTION_EDITOR_PASTE, new PasteHandler()); - registerActionHandler(editor, IdeActions.ACTION_EDITOR_BACKSPACE, new BackSpaceHandler()); - registerActionHandler(editor, IdeActions.ACTION_EDITOR_DELETE, new DeleteHandler()); + private void registerConsoleEditorActions() { + HyperlinkNavigationAction hyperlinkNavigationAction = new HyperlinkNavigationAction(); + hyperlinkNavigationAction.registerCustomShortcutSet(CommonShortcuts.ENTER, myEditor.getContentComponent()); + registerActionHandler(myEditor, IdeActions.ACTION_GOTO_DECLARATION, hyperlinkNavigationAction); + + if (!myIsViewer) { + new EnterHandler().registerCustomShortcutSet(CommonShortcuts.ENTER, myEditor.getContentComponent()); + registerActionHandler(myEditor, IdeActions.ACTION_EDITOR_PASTE, new PasteHandler()); + registerActionHandler(myEditor, IdeActions.ACTION_EDITOR_BACKSPACE, new BackSpaceHandler()); + registerActionHandler(myEditor, IdeActions.ACTION_EDITOR_DELETE, new DeleteHandler()); + } } private static void registerActionHandler(final Editor editor, final String actionId, final AnAction action) { @@ -1555,7 +1560,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo synchronized (consoleView.LOCK) { if (consoleView.myTokens.isEmpty()) return; final TokenInfo info = consoleView.myTokens.get(consoleView.myTokens.size() - 1); - if (info.contentType != ConsoleViewContentType.USER_INPUT && !textToUse.contains("\n")) { + if (info.contentType != ConsoleViewContentType.USER_INPUT && !StringUtil.containsChar(textToUse, '\n')) { consoleView.print(textToUse, ConsoleViewContentType.USER_INPUT); consoleView.flushDeferredText(); editor.getCaretModel().moveToOffset(document.getTextLength()); @@ -1849,5 +1854,19 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo public Project getProject() { return myProject; } + + private class HyperlinkNavigationAction extends DumbAwareAction { + @Override + public void actionPerformed(AnActionEvent e) { + Runnable runnable = myHyperlinks.getLinkNavigationRunnable(myEditor.getCaretModel().getLogicalPosition()); + assert runnable != null; + runnable.run(); + } + + @Override + public void update(AnActionEvent e) { + e.getPresentation().setEnabled(myHyperlinks.getLinkNavigationRunnable(myEditor.getCaretModel().getLogicalPosition()) != null); + } + } } diff --git a/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java b/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java index 0a62ed853d0e..df7f7e1b2e1c 100644 --- a/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java +++ b/platform/lang-impl/src/com/intellij/execution/runners/AbstractConsoleRunnerWithHistory.java @@ -26,7 +26,6 @@ import com.intellij.execution.ui.RunContentDescriptor; import com.intellij.execution.ui.actions.CloseAction; import com.intellij.ide.CommonActionsManager; import com.intellij.openapi.actionSystem.*; -import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; import com.intellij.ui.SideBorder; @@ -55,7 +54,7 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole private final Project myProject; - private ConsoleExecuteActionHandler myConsoleExecuteActionHandler; + private ProcessBackedConsoleExecuteActionHandler myConsoleExecuteActionHandler; public AbstractConsoleRunnerWithHistory(@NotNull Project project, @NotNull String consoleTitle, @Nullable String workingDir) { myProject = project; @@ -87,7 +86,7 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole } myProcessHandler = createProcessHandler(process); - myConsoleExecuteActionHandler = createConsoleExecuteActionHandler(); + myConsoleExecuteActionHandler = createExecuteActionHandler(); ProcessTerminatedListener.attach(myProcessHandler); @@ -98,15 +97,15 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole } }); -// Attach to process + // Attach to process myConsoleView.attachToProcess(myProcessHandler); -// Runner creating + // Runner creating final Executor defaultExecutor = DefaultRunExecutor.getRunExecutorInstance(); final DefaultActionGroup toolbarActions = new DefaultActionGroup(); final ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, toolbarActions, false); -// Runner creating + // Runner creating final JPanel panel = new JPanel(new BorderLayout()); panel.add(actionToolbar.getComponent(), BorderLayout.WEST); panel.add(myConsoleView.getComponent(), BorderLayout.CENTER); @@ -119,21 +118,20 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole contentDescriptor.setFocusComputable(new Computable<JComponent>() { @Override public JComponent compute() { - final EditorEx editor = getLanguageConsole().getConsoleEditor(); - return editor.getContentComponent(); + return getLanguageConsole().getConsoleEditor().getContentComponent(); } }); contentDescriptor.setAutoFocusContent(isAutoFocusContent()); -// tool bar actions + // tool bar actions final List<AnAction> actions = fillToolBarActions(toolbarActions, defaultExecutor, contentDescriptor); registerActionShortcuts(actions, getLanguageConsole().getConsoleEditor().getComponent()); registerActionShortcuts(actions, panel); panel.updateUI(); showConsole(defaultExecutor, contentDescriptor); -// Run + // Run myProcessHandler.startNotify(); } @@ -210,18 +208,16 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole List<AnAction> actionList = ContainerUtil.newArrayList(); -//stop - final AnAction stopAction = createStopAction(); - actionList.add(stopAction); + //stop + actionList.add(createStopAction()); -//close - final AnAction closeAction = createCloseAction(defaultExecutor, contentDescriptor); - actionList.add(closeAction); + //close + actionList.add(createCloseAction(defaultExecutor, contentDescriptor)); -// run action - actionList.add(createConsoleExecAction(myConsoleView, myProcessHandler, myConsoleExecuteActionHandler)); + // run action + actionList.add(createConsoleExecAction(myConsoleExecuteActionHandler)); -// Help + // Help actionList.add(CommonActionsManager.getInstance().createHelpAction("interactive_console")); toolbarActions.addAll(actionList); @@ -241,16 +237,46 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole return myConsoleView.getConsole(); } - public static AnAction createConsoleExecAction(final LanguageConsoleView console, - final ProcessHandler processHandler, - final ConsoleExecuteActionHandler consoleExecuteActionHandler) { - return new ConsoleExecuteAction(console, consoleExecuteActionHandler, consoleExecuteActionHandler.getEmptyExecuteAction(), - new LanguageConsoleBuilder.ProcessBackedExecutionEnabledCondition(processHandler)); + @SuppressWarnings("UnusedDeclaration") + @Deprecated + /** + * @deprecated to remove in IDEA 14 + */ + public static AnAction createConsoleExecAction(@NotNull LanguageConsoleView console, + @NotNull ProcessHandler processHandler, + @NotNull ProcessBackedConsoleExecuteActionHandler consoleExecuteActionHandler) { + return new ConsoleExecuteAction(console, consoleExecuteActionHandler, consoleExecuteActionHandler.getEmptyExecuteAction(), consoleExecuteActionHandler); + } + + protected AnAction createConsoleExecAction(@NotNull ProcessBackedConsoleExecuteActionHandler consoleExecuteActionHandler) { + return new ConsoleExecuteAction(myConsoleView, consoleExecuteActionHandler, consoleExecuteActionHandler.getEmptyExecuteAction(), consoleExecuteActionHandler); + } + + @SuppressWarnings("UnusedDeclaration") + @Deprecated + /** + * @deprecated to remove in IDEA 14 + */ + public static AnAction createConsoleExecAction(LanguageConsoleImpl languageConsole, + ProcessHandler processHandler, + @SuppressWarnings("deprecation") ConsoleExecuteActionHandler consoleExecuteActionHandler) { + return ConsoleExecuteAction.createAction(languageConsole, consoleExecuteActionHandler); } @NotNull - protected abstract ConsoleExecuteActionHandler createConsoleExecuteActionHandler(); + protected ProcessBackedConsoleExecuteActionHandler createExecuteActionHandler() { + //noinspection deprecation + return createConsoleExecuteActionHandler(); + } + @SuppressWarnings({"UnusedDeclaration", "deprecation"}) + @Deprecated + /** + * @deprecated to remove in IDEA 14 + */ + protected ConsoleExecuteActionHandler createConsoleExecuteActionHandler() { + throw new AbstractMethodError(); + } public T getConsoleView() { return myConsoleView; @@ -272,7 +298,7 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole return myProcessHandler; } - public ConsoleExecuteActionHandler getConsoleExecuteActionHandler() { + public ProcessBackedConsoleExecuteActionHandler getConsoleExecuteActionHandler() { return myConsoleExecuteActionHandler; } } diff --git a/platform/lang-impl/src/com/intellij/execution/runners/ConsoleExecuteActionHandler.java b/platform/lang-impl/src/com/intellij/execution/runners/ConsoleExecuteActionHandler.java index d362e824dc8b..52e8ebf70bb5 100644 --- a/platform/lang-impl/src/com/intellij/execution/runners/ConsoleExecuteActionHandler.java +++ b/platform/lang-impl/src/com/intellij/execution/runners/ConsoleExecuteActionHandler.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. @@ -15,74 +15,17 @@ */ package com.intellij.execution.runners; -import com.intellij.execution.console.BaseConsoleExecuteActionHandler; -import com.intellij.execution.console.LanguageConsoleView; -import com.intellij.execution.process.BaseOSProcessHandler; +import com.intellij.execution.console.ProcessBackedConsoleExecuteActionHandler; import com.intellij.execution.process.ProcessHandler; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.IOException; -import java.io.OutputStream; -import java.nio.charset.Charset; +@SuppressWarnings({"ClassNameSameAsAncestorName", "UnusedDeclaration"}) +@Deprecated /** - * @author traff + * @deprecated Use {@link ProcessBackedConsoleExecuteActionHandler} + * to remove in IDEA 15 */ -public class ConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler { - private ProcessHandler myProcessHandler; - +public class ConsoleExecuteActionHandler extends ProcessBackedConsoleExecuteActionHandler { public ConsoleExecuteActionHandler(ProcessHandler processHandler, boolean preserveMarkup) { - super(preserveMarkup); - - myProcessHandler = processHandler; - } - - @Nullable - private synchronized ProcessHandler getProcessHandler() { - return myProcessHandler; - } - - public synchronized void setProcessHandler(@NotNull final ProcessHandler processHandler) { - myProcessHandler = processHandler; - } - - @Override - protected void execute(@NotNull String text, @NotNull LanguageConsoleView console) { - //noinspection deprecation - execute(text); - } - - @Deprecated - /** - * @deprecated to remove in IDEA 15 - */ - protected void execute(@NotNull String text) { - processLine(text); - } - - public void processLine(@NotNull String line) { - sendText(line + "\n"); - } - - public void sendText(String line) { - final Charset charset = myProcessHandler instanceof BaseOSProcessHandler ? - ((BaseOSProcessHandler)myProcessHandler).getCharset() : null; - final ProcessHandler handler = getProcessHandler(); - assert handler != null : "process handler is null"; - final OutputStream outputStream = handler.getProcessInput(); - assert outputStream != null : "output stream is null"; - try { - byte[] bytes = charset != null ? (line + "\n").getBytes(charset) : line.getBytes(); - outputStream.write(bytes); - outputStream.flush(); - } - catch (IOException ignored) { - } - } - - public final boolean isProcessTerminated() { - final ProcessHandler handler = getProcessHandler(); - return handler == null || handler.isProcessTerminated(); + super(processHandler, preserveMarkup); } }
\ No newline at end of file diff --git a/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/ToggleToolbarLayoutAction.java b/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/ToggleToolbarLayoutAction.java index c9ccade706fb..98e7d535c693 100644 --- a/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/ToggleToolbarLayoutAction.java +++ b/platform/lang-impl/src/com/intellij/execution/ui/layout/actions/ToggleToolbarLayoutAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,33 +19,35 @@ package com.intellij.execution.ui.layout.actions; import com.intellij.execution.ui.layout.impl.RunnerContentUi; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.ToggleAction; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ToggleToolbarLayoutAction extends ToggleAction { - @Override public void update(final AnActionEvent e) { if (getRunnerUi(e) == null) { e.getPresentation().setEnabled(false); - } else { + } + else { super.update(e); } } @Override - public boolean isSelected(final AnActionEvent e) { - final RunnerContentUi ui = getRunnerUi(e); + public boolean isSelected(@NotNull AnActionEvent e) { + RunnerContentUi ui = getRunnerUi(e); return ui != null && ui.isHorizontalToolbar(); } @Override - public void setSelected(final AnActionEvent e, final boolean state) { - getRunnerUi(e).setHorizontalToolbar(state); + public void setSelected(@NotNull AnActionEvent e, boolean state) { + RunnerContentUi ui = getRunnerUi(e); + assert ui != null; + ui.setHorizontalToolbar(state); } @Nullable - public static RunnerContentUi getRunnerUi(final AnActionEvent e) { + public static RunnerContentUi getRunnerUi(@NotNull AnActionEvent e) { return RunnerContentUi.KEY.getData(e.getDataContext()); } - } diff --git a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java index 48fe5db1ecf7..2fefcc9649d4 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java +++ b/platform/lang-impl/src/com/intellij/find/impl/FindInProjectUtil.java @@ -54,6 +54,7 @@ import com.intellij.openapi.vfs.*; import com.intellij.openapi.vfs.ex.VirtualFileManagerEx; import com.intellij.psi.*; import com.intellij.psi.impl.cache.CacheManager; +import com.intellij.psi.impl.cache.impl.id.IdIndex; import com.intellij.psi.search.*; import com.intellij.ui.content.Content; import com.intellij.usageView.UsageInfo; @@ -69,6 +70,7 @@ import com.intellij.util.PatternUtil; import com.intellij.util.Processor; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.indexing.FileBasedIndex; +import com.intellij.util.indexing.FileBasedIndexImpl; import gnu.trove.THashSet; import gnu.trove.TIntHashSet; import gnu.trove.TIntIterator; @@ -345,7 +347,7 @@ public class FindInProjectUtil { Pair<Boolean, Collection<PsiFile>> fastWords = getFilesForFastWordSearch(findModel, project, psiDirectory, fileMaskRegExp, module, fileIndex); final Collection<PsiFile> filesForFastWordSearch = fastWords.getSecond(); - if (fastWords.getFirst() && canOptimizeForFastWordSearch(findModel)) return filesForFastWordSearch; + final boolean useIdIndex = fastWords.getFirst() && canOptimizeForFastWordSearch(findModel); SearchScope customScope = findModel.getCustomScope(); final GlobalSearchScope globalCustomScope = toGlobal(project, customScope); @@ -357,13 +359,19 @@ public class FindInProjectUtil { @Override public boolean processFile(@NotNull VirtualFile virtualFile) { ProgressManager.checkCanceled(); - if (!virtualFile.isDirectory() && - (fileMaskRegExp == null || fileMaskRegExp.matcher(virtualFile.getName()).matches()) && - (globalCustomScope == null || globalCustomScope.contains(virtualFile))) { - final PsiFile psiFile = findFile(psiManager, virtualFile); - if (psiFile != null && !filesForFastWordSearch.contains(psiFile)) { - myFiles.add(psiFile); - } + if (virtualFile.isDirectory() || + (fileMaskRegExp != null && !fileMaskRegExp.matcher(virtualFile.getName()).matches()) || + (globalCustomScope != null && !globalCustomScope.contains(virtualFile))) { + return true; + } + + if (useIdIndex && isCoveredByIdIndex(virtualFile)) { + return true; + } + + PsiFile psiFile = findFile(psiManager, virtualFile); + if (psiFile != null && !(psiFile instanceof PsiBinaryFile)) { + myFiles.add(psiFile); } return true; } @@ -414,6 +422,11 @@ public class FindInProjectUtil { return Collections.emptyList(); } + private static boolean isCoveredByIdIndex(VirtualFile file) { + return IdIndex.isIndexable(FileBasedIndexImpl.getFileType(file)) && + ((FileBasedIndexImpl)FileBasedIndex.getInstance()).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() { diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java index bf172257afb4..c20b5925721d 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java +++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java @@ -262,6 +262,7 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search @Override public void run() { for (FoldRegion region : allRegions) { + if (!region.isValid()) continue; if (cursor.intersects(TextRange.create(region))) { region.setExpanded(true); } diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java index 893072bb0ccc..384c92ee0427 100644 --- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java +++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java @@ -219,6 +219,8 @@ public class SearchResults implements DocumentListener { ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { + Project project = getProject(); + if (myDisposed || project != null && project.isDisposed()) return; int[] starts = new int[0]; int[] ends = new int[0]; try { diff --git a/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java b/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java index af5164daad06..e475f8cf83d4 100644 --- a/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java +++ b/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java @@ -48,9 +48,11 @@ public class FormatterTagHandler { !StringUtil.isEmpty(mySettings.FORMATTER_OFF_TAG) && block instanceof ASTBlock) { ASTNode node = ((ASTBlock)block).getNode(); - PsiElement element = node.getPsi(); - if (element != null && element instanceof PsiComment) { - return getFormatterTag((PsiComment)element); + if (node != null) { + PsiElement element = node.getPsi(); + if (element != null && element instanceof PsiComment) { + return getFormatterTag((PsiComment)element); + } } } return FormatterTag.NONE; diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java index 7070b065c959..8b44a0ece134 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 class GotoClassAction extends GotoActionBase implements DumbAware { return null; } - private static PsiElement getElement(PsiElement element, ChooseByNamePopup popup) { + private static PsiElement getElement(@NotNull PsiElement element, ChooseByNamePopup popup) { final String path = popup.getPathToAnonymous(); if (path != null) { final String[] classes = path.split("\\$"); @@ -214,10 +214,11 @@ public class GotoClassAction extends GotoActionBase implements DumbAware { return element; } - static PsiElement[] getAnonymousClasses(PsiElement element) { + @NotNull + private static PsiElement[] getAnonymousClasses(@NotNull PsiElement element) { for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) { final PsiElement[] elements = provider.getAnonymousElements(element); - if (elements != null && elements.length > 0) { + if (elements.length > 0) { return elements; } } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/SaveFileAsTemplateAction.java b/platform/lang-impl/src/com/intellij/ide/actions/SaveFileAsTemplateAction.java index 974c15e61efe..f0d99a3a2976 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/SaveFileAsTemplateAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/SaveFileAsTemplateAction.java @@ -21,23 +21,25 @@ import com.intellij.ide.fileTemplates.ui.ConfigureTemplatesDialog; 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.extensions.Extensions; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; +import static com.intellij.util.ObjectUtils.assertNotNull; + public class SaveFileAsTemplateAction extends AnAction{ @Override public void actionPerformed(AnActionEvent e){ Project project = e.getData(CommonDataKeys.PROJECT); - String fileText = e.getData(PlatformDataKeys.FILE_TEXT); - VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); - String extension = file.getExtension(); + String fileText = assertNotNull(e.getData(PlatformDataKeys.FILE_TEXT)); + VirtualFile file = assertNotNull(e.getData(CommonDataKeys.VIRTUAL_FILE)); + String extension = assertNotNull(file.getExtension()); String nameWithoutExtension = file.getNameWithoutExtension(); AllFileTemplatesConfigurable fileTemplateOptions = new AllFileTemplatesConfigurable(); ConfigureTemplatesDialog dialog = new ConfigureTemplatesDialog(project, fileTemplateOptions); + fileTemplateOptions.selectTemplatesTab(); PsiFile psiFile = e.getData(CommonDataKeys.PSI_FILE); for(SaveFileAsTemplateHandler handler: Extensions.getExtensions(SaveFileAsTemplateHandler.EP_NAME)) { String textFromHandler = handler.getTemplateText(psiFile, fileText, nameWithoutExtension); @@ -54,6 +56,6 @@ public class SaveFileAsTemplateAction extends AnAction{ public void update(AnActionEvent e) { VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); String fileText = e.getData(PlatformDataKeys.FILE_TEXT); - e.getPresentation().setEnabled((fileText != null) && (file != null)); + e.getPresentation().setEnabled(fileText != null && file != null && file.getExtension() != null); } } diff --git a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java index 3d48cd908530..b2533d5fad35 100644 --- a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java +++ b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.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. @@ -22,6 +22,7 @@ import com.intellij.ide.structureView.StructureViewBuilder; import com.intellij.ide.structureView.StructureViewModel; import com.intellij.ide.util.FileStructureDialog; import com.intellij.ide.util.FileStructurePopup; +import com.intellij.ide.util.treeView.smartTree.TreeStructureUtil; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; @@ -41,7 +42,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ViewStructureAction extends AnAction { - private static final String PLACE = "StructureViewPopup"; public ViewStructureAction() { setEnabledInModalContext(true); @@ -56,16 +56,16 @@ public class ViewStructureAction extends AnAction { final VirtualFile virtualFile; final Editor editor = e.getData(CommonDataKeys.EDITOR); - if (editor != null) { + if (editor == null) { + virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); + } + else { PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument()); PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); if (psiFile == null) return; virtualFile = psiFile.getVirtualFile(); } - else { - virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE); - } String title = virtualFile == null? fileEditor.getName() : virtualFile.getName(); FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file.structure"); @@ -79,6 +79,7 @@ public class ViewStructureAction extends AnAction { popup.show(); } else { + assert editor != null; DialogWrapper dialog = createDialog(editor, project, navigatable, fileEditor); if (dialog == null) return; @@ -88,7 +89,10 @@ public class ViewStructureAction extends AnAction { } @Nullable - private static DialogWrapper createDialog(@Nullable Editor editor, @NotNull Project project, @Nullable Navigatable navigatable, @NotNull FileEditor fileEditor) { + private static DialogWrapper createDialog(@NotNull Editor editor, + @NotNull Project project, + @Nullable Navigatable navigatable, + @NotNull FileEditor fileEditor) { final StructureViewBuilder structureViewBuilder = fileEditor.getStructureViewBuilder(); if (structureViewBuilder == null) return null; StructureView structureView = structureViewBuilder.createStructureView(fileEditor, project); @@ -103,18 +107,15 @@ public class ViewStructureAction extends AnAction { StructureViewModel model = structureView.getTreeModel(); if (model instanceof PlaceHolder) { //noinspection unchecked - ((PlaceHolder)model).setPlace(PLACE); + ((PlaceHolder)model).setPlace(TreeStructureUtil.PLACE); } return createStructureViewPopup(project, fileEditor, structureView); } - public static boolean isInStructureViewPopup(@NotNull PlaceHolder<String> model) { - return PLACE.equals(model.getPlace()); - } - - private static FileStructureDialog createStructureViewBasedDialog(StructureViewModel structureViewModel, - Editor editor, - Project project, + @NotNull + private static FileStructureDialog createStructureViewBasedDialog(@NotNull StructureViewModel structureViewModel, + @NotNull Editor editor, + @NotNull Project project, Navigatable navigatable, @NotNull Disposable alternativeDisposable) { return new FileStructureDialog(structureViewModel, editor, project, navigatable, alternativeDisposable, true); diff --git a/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java b/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java index bc4064a3fb6d..0591a5014437 100644 --- a/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -216,7 +216,7 @@ public class ProjectListBuilder extends AbstractListBuilder { } @Override - public void fileStatusChanged(final VirtualFile vFile) { + public void fileStatusChanged(@NotNull final VirtualFile vFile) { final PsiManager manager = PsiManager.getInstance(myProject); if (vFile.isDirectory()) { diff --git a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java index 6ef0f909450e..925183c4a5ce 100644 --- a/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java +++ b/platform/lang-impl/src/com/intellij/ide/fileTemplates/impl/AllFileTemplatesConfigurable.java @@ -570,28 +570,37 @@ public class AllFileTemplatesConfigurable implements SearchableConfigurable, Con } } + public void selectTemplatesTab() { + selectTab(TEMPLATES_TITLE); + } + + private boolean selectTab(String tabName) { + int idx = 0; + for (FileTemplateTab tab : myTabs) { + if (Comparing.strEqual(tab.getTitle(), tabName)) { + myCurrentTab = tab; + myTabbedPane.setSelectedIndex(idx); + return true; + } + idx++; + } + return false; + } + @Override public void reset() { myEditor.reset(); initLists(); final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance(); final String tabName = propertiesComponent.getValue(CURRENT_TAB); - int idx = 0; - for (FileTemplateTab tab : myTabs) { - if (Comparing.strEqual(tab.getTitle(), tabName)) { - myCurrentTab = tab; - myTabbedPane.setSelectedIndex(idx); - final String selectedTemplateName = propertiesComponent.getValue(SELECTED_TEMPLATE); - final FileTemplate[] templates = myCurrentTab.getTemplates(); - for (FileTemplate template : templates) { - if (Comparing.strEqual(template.getName(), selectedTemplateName)) { - tab.selectTemplate(template); - break; - } + if (selectTab(tabName)) { + final String selectedTemplateName = propertiesComponent.getValue(SELECTED_TEMPLATE); + for (FileTemplate template : myCurrentTab.getTemplates()) { + if (Comparing.strEqual(template.getName(), selectedTemplateName)) { + myCurrentTab.selectTemplate(template); + break; } - break; } - idx++; } myModified = false; } diff --git a/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java b/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java index ec026cacd275..048ca1d72427 100644 --- a/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.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 @@ import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.Update; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -74,6 +75,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl private VirtualFile myFile; private StructureView myStructureView; + private FileEditor myFileEditor; private ModuleStructureComponent myModuleStructureComponent; private JPanel[] myPanels = new JPanel[0]; @@ -222,7 +224,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl @Override public void run() { if (myStructureView != null) { - if (!Comparing.equal(myStructureView.getFileEditor(), fileEditor)) { + if (!Comparing.equal(myFileEditor, fileEditor)) { myFile = file; rebuild(); } @@ -269,6 +271,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl myStructureView.storeState(); Disposer.dispose(myStructureView); myStructureView = null; + myFileEditor = null; } if (myModuleStructureComponent != null) { @@ -290,7 +293,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl } } - String[] names = new String[] {""}; + String[] names = {""}; JComponent focusedComponent = null; if (file != null && file.isValid()) { if (file.isDirectory()) { @@ -315,6 +318,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl final StructureViewBuilder structureViewBuilder = editor.getStructureViewBuilder(); if (structureViewBuilder != null) { myStructureView = structureViewBuilder.createStructureView(editor, myProject); + myFileEditor = editor; Disposer.register(this, myStructureView); updateHeaderActions(myStructureView); @@ -322,18 +326,17 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl ((StructureView.Scrollable)myStructureView).setReferenceSizeWhileInitializing(referenceSize); } - final StructureViewComposite.StructureViewDescriptor[] views; - if (myStructureView instanceof StructureViewComposite) { final StructureViewComposite composite = (StructureViewComposite)myStructureView; - views = composite.getStructureViews(); + final StructureViewComposite.StructureViewDescriptor[] views = composite.getStructureViews(); myPanels = new JPanel[views.length]; names = new String[views.length]; for (int i = 0; i < myPanels.length; i++) { myPanels[i] = createContentPanel(views[i].structureView.getComponent()); names[i] = views[i].title; } - } else { + } + else { createSinglePanel(myStructureView.getComponent()); } focusedComponent = hadFocus ? IdeFocusTraversalPolicy.getPreferredFocusedComponent(myStructureView.getComponent()) : null; @@ -393,15 +396,12 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl } @Nullable - private FileEditor createTempFileEditor(VirtualFile file) { + private FileEditor createTempFileEditor(@NotNull VirtualFile file) { if (file.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return null; FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance(); final FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file); - for (FileEditorProvider provider : providers) { - return provider.createEditor(myProject, file); - } - return null; + return providers.length == 0 ? null : providers[0].createEditor(myProject, file); } diff --git a/platform/lang-impl/src/com/intellij/ide/macro/ColumnNumberMacro.java b/platform/lang-impl/src/com/intellij/ide/macro/ColumnNumberMacro.java index 666bac1a6a71..f9ee6b75e8a7 100644 --- a/platform/lang-impl/src/com/intellij/ide/macro/ColumnNumberMacro.java +++ b/platform/lang-impl/src/com/intellij/ide/macro/ColumnNumberMacro.java @@ -26,6 +26,6 @@ public final class ColumnNumberMacro extends EditorMacro { @Override protected String expand(Editor editor) { - return String.valueOf(editor.getCaretModel().getLogicalPosition().column + 1); + return getColumnNumber(editor, editor.getCaretModel().getLogicalPosition()); } } diff --git a/platform/lang-impl/src/com/intellij/ide/macro/EditorMacro.java b/platform/lang-impl/src/com/intellij/ide/macro/EditorMacro.java index d253ed586628..5092eff72e94 100644 --- a/platform/lang-impl/src/com/intellij/ide/macro/EditorMacro.java +++ b/platform/lang-impl/src/com/intellij/ide/macro/EditorMacro.java @@ -18,6 +18,8 @@ package com.intellij.ide.macro; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.LogicalPosition; +import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.wm.ToolWindowManager; import org.jetbrains.annotations.Nullable; @@ -57,6 +59,19 @@ public abstract class EditorMacro extends Macro { return null; } + /** + * @return 1-based column index where tabs are treated as single characters. External tools don't know about IDEA's tab size. + */ + protected static String getColumnNumber(Editor editor, LogicalPosition pos) { + if (EditorUtil.inVirtualSpace(editor, pos)) { + return String.valueOf(pos.column + 1); + } + + int offset = editor.logicalPositionToOffset(pos); + int lineStart = editor.getDocument().getLineStartOffset(editor.getDocument().getLineNumber(offset)); + return String.valueOf(offset - lineStart + 1); + } + @Nullable protected abstract String expand(Editor editor); } diff --git a/platform/lang-impl/src/com/intellij/ide/macro/SelectionEndColumnMacro.java b/platform/lang-impl/src/com/intellij/ide/macro/SelectionEndColumnMacro.java index 4110c088ccee..97326c0f3cb6 100644 --- a/platform/lang-impl/src/com/intellij/ide/macro/SelectionEndColumnMacro.java +++ b/platform/lang-impl/src/com/intellij/ide/macro/SelectionEndColumnMacro.java @@ -32,6 +32,6 @@ public class SelectionEndColumnMacro extends EditorMacro { if (selectionEndPosition == null) { return null; } - return String.valueOf(editor.visualToLogicalPosition(selectionEndPosition).column + 1); + return getColumnNumber(editor, editor.visualToLogicalPosition(selectionEndPosition)); } } diff --git a/platform/lang-impl/src/com/intellij/ide/macro/SelectionStartColumnMacro.java b/platform/lang-impl/src/com/intellij/ide/macro/SelectionStartColumnMacro.java index 30b82c76cade..7578eb491687 100644 --- a/platform/lang-impl/src/com/intellij/ide/macro/SelectionStartColumnMacro.java +++ b/platform/lang-impl/src/com/intellij/ide/macro/SelectionStartColumnMacro.java @@ -32,6 +32,6 @@ public class SelectionStartColumnMacro extends EditorMacro { if (selectionStartPosition == null) { return null; } - return String.valueOf(editor.visualToLogicalPosition(selectionStartPosition).column + 1); + return getColumnNumber(editor, editor.visualToLogicalPosition(selectionStartPosition)); } } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java index 34ccfc64504c..bb80f55237e5 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java @@ -672,6 +672,7 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl return dragAction == DnDConstants.ACTION_MOVE && MoveHandler.canMove(dataContext); } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { if (myTreeBuilder == null || myTreeBuilder.isDisposed()) return new ActionCallback.Rejected(); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java index 55909752ab2f..c7a81cbd0cda 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.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. @@ -1858,6 +1858,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo return mySelectInTargets.values(); } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { AbstractProjectViewPane pane = myId2Pane.get(myCurrentViewSubId); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java index 3ef138d82542..58591a139949 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,6 +62,7 @@ public abstract class AbstractModuleNode extends ProjectViewNode<Module> impleme return "Module"; } + @NotNull @Override public Collection<VirtualFile> getRoots() { return Arrays.asList(ModuleRootManager.getInstance(getValue()).getContentRoots()); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java index 1c3dca9dbb3a..621dd67af1e2 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -70,6 +70,7 @@ public abstract class ModuleGroupNode extends ProjectViewNode<ModuleGroup> imple return result; } + @NotNull @Override public Collection<VirtualFile> getRoots() { Collection<AbstractTreeNode> children = getChildren(); diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java index 809c41cb9bf0..ab954007b0d3 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.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. @@ -23,13 +23,13 @@ import com.intellij.openapi.util.Key; import com.intellij.psi.PsiElement; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * @author peter */ public class PsiTreeAnchorizer extends TreeAnchorizer { - private static final Key<SmartPointerWrapper> PSI_ANCHORIZER_POINTER = Key.create("PSI_ANCHORIZER_POINTER"); @Override @@ -47,7 +47,8 @@ public class PsiTreeAnchorizer extends TreeAnchorizer { if (pointer == null || pointer.myPointer.getElement() != psiElement) { Project project = psiElement.getProject(); - pointer = new SmartPointerWrapper(SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement)); + SmartPsiElementPointer<PsiElement> psiElementPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement); + pointer = new SmartPointerWrapper(psiElementPointer); psiElement.putUserData(PSI_ANCHORIZER_POINTER, pointer); } return pointer; @@ -74,7 +75,7 @@ public class PsiTreeAnchorizer extends TreeAnchorizer { private static class SmartPointerWrapper { private final SmartPsiElementPointer myPointer; - private SmartPointerWrapper(SmartPsiElementPointer pointer) { + private SmartPointerWrapper(@NotNull SmartPsiElementPointer pointer) { myPointer = pointer; } diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java index 8fa7e9b054c0..ccacc10761b9 100644 --- a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.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. @@ -40,7 +40,6 @@ import com.intellij.psi.PsiFileSystemItem; import com.intellij.psi.PsiManager; import com.intellij.psi.search.scope.NonProjectFilesScope; import com.intellij.psi.search.scope.packageSet.*; -import com.intellij.ui.PopupHandler; import com.intellij.util.Alarm; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; @@ -252,6 +251,7 @@ public class ScopeViewPane extends AbstractProjectViewPane { return myViewPanel != null ? myViewPanel.getData(dataId) : null; } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { final ActionCallback callback = myViewPanel.getActionCallback(); diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java index d49da8097bfc..8955f0769922 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java @@ -106,8 +106,9 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple } } + @NotNull @Override - public Collection<StructureViewExtension> getAllExtensions(Class<? extends PsiElement> type) { + public Collection<StructureViewExtension> getAllExtensions(@NotNull Class<? extends PsiElement> type) { Collection<StructureViewExtension> result = myImplExtensions.get(type); if (result == null) { MultiValuesMap<Class<? extends PsiElement>, StructureViewExtension> map = myExtensions.getValue(); @@ -154,7 +155,7 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple } @Override - public void runWhenInitialized(Runnable runnable) { + public void runWhenInitialized(@NotNull Runnable runnable) { if (myStructureViewWrapperImpl != null) { runnable.run(); } @@ -163,14 +164,20 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple } } + @NotNull @Override - public StructureView createStructureView(final FileEditor fileEditor, final StructureViewModel treeModel, final Project project) { - return new StructureViewComponent(fileEditor, treeModel, project); + public StructureView createStructureView(final FileEditor fileEditor, + @NotNull final StructureViewModel treeModel, + @NotNull final Project project) { + return createStructureView(fileEditor, treeModel, project, true); } + @NotNull @Override public StructureView createStructureView(final FileEditor fileEditor, - final StructureViewModel treeModel, final Project project, final boolean showRootNode) { + @NotNull StructureViewModel treeModel, + @NotNull Project project, + final boolean showRootNode) { return new StructureViewComponent(fileEditor, treeModel, project, showRootNode); } } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java index 6886470e1a87..83174587bf01 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.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. @@ -155,7 +155,7 @@ public abstract class TemplateLanguageStructureViewBuilder implements StructureV @Override @NotNull - public StructureView createStructureView(FileEditor fileEditor, Project project) { + public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) { myFileEditor = fileEditor; List<StructureViewComposite.StructureViewDescriptor> viewDescriptors = new ArrayList<StructureViewComposite.StructureViewDescriptor>(); final TemplateLanguageFileViewProvider provider = getViewProvider(); diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java index ae8cedaf9129..6ac9813606ce 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.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. @@ -92,13 +92,9 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre private final StructureViewModel myTreeModel; private static int ourSettingsModificationCount; - public StructureViewComponent(FileEditor editor, StructureViewModel structureViewModel, Project project) { - this(editor, structureViewModel, project, true); - } - public StructureViewComponent(final FileEditor editor, - final StructureViewModel structureViewModel, - final Project project, + @NotNull StructureViewModel structureViewModel, + @NotNull Project project, final boolean showRootNode) { super(true, true); @@ -236,7 +232,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre } - private static Object[] convertPathsToValues(TreePath[] selectionPaths) { + private static Object[] convertPathsToValues(@Nullable TreePath[] selectionPaths) { if (selectionPaths == null) return null; List<Object> result = new ArrayList<Object>(); for (TreePath selectionPath : selectionPaths) { @@ -861,13 +857,11 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre final Object o = unwrapValue(getValue()); long currentStamp; - if (( o instanceof PsiElement && + if (o instanceof PsiElement && ((PsiElement)o).getNode() instanceof CompositeElement && - childrenStamp != (currentStamp = ((CompositeElement)((PsiElement)o).getNode()).getModificationCount()) - ) || - ( o instanceof ModificationTracker && + childrenStamp != (currentStamp = ((CompositeElement)((PsiElement)o).getNode()).getModificationCount()) || + o instanceof ModificationTracker && childrenStamp != (currentStamp = ((ModificationTracker)o).getModificationCount()) - ) ) { resetChildren(); childrenStamp = currentStamp; @@ -882,26 +876,22 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre @Override public boolean isAlwaysShowPlus() { - if (getElementInfoProvider() != null) { - return getElementInfoProvider().isAlwaysShowsPlus((StructureViewTreeElement)getValue()); - } - return true; + StructureViewModel.ElementInfoProvider elementInfoProvider = getElementInfoProvider(); + return elementInfoProvider == null || elementInfoProvider.isAlwaysShowsPlus((StructureViewTreeElement)getValue()); } @Override public boolean isAlwaysLeaf() { - if (getElementInfoProvider() != null) { - return getElementInfoProvider().isAlwaysLeaf((StructureViewTreeElement)getValue()); - } - - return false; + StructureViewModel.ElementInfoProvider elementInfoProvider = getElementInfoProvider(); + return elementInfoProvider != null && elementInfoProvider.isAlwaysLeaf((StructureViewTreeElement)getValue()); } @Nullable private StructureViewModel.ElementInfoProvider getElementInfoProvider() { if (myTreeModel instanceof StructureViewModel.ElementInfoProvider) { - return ((StructureViewModel.ElementInfoProvider)myTreeModel); - } else if (myTreeModel instanceof TreeModelWrapper) { + return (StructureViewModel.ElementInfoProvider)myTreeModel; + } + if (myTreeModel instanceof TreeModelWrapper) { StructureViewModel model = ((TreeModelWrapper)myTreeModel).getModel(); if (model instanceof StructureViewModel.ElementInfoProvider) { return (StructureViewModel.ElementInfoProvider)model; @@ -912,12 +902,12 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre } @Override - protected TreeElementWrapper createChildNode(final TreeElement child) { + protected TreeElementWrapper createChildNode(@NotNull final TreeElement child) { return new StructureViewTreeElementWrapper(myProject, child, myTreeModel); } @Override - protected GroupWrapper createGroupWrapper(final Project project, Group group, final TreeModel treeModel) { + protected GroupWrapper createGroupWrapper(final Project project, @NotNull Group group, final TreeModel treeModel) { return new StructureViewGroup(project, group, treeModel); } @@ -940,9 +930,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre if (o instanceof StructureViewTreeElement) { return ((StructureViewTreeElement)o).getValue(); } - else { - return o; - } + return o; } public int hashCode() { @@ -957,13 +945,13 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre } @Override - protected TreeElementWrapper createChildNode(TreeElement child) { + protected TreeElementWrapper createChildNode(@NotNull TreeElement child) { return new StructureViewTreeElementWrapper(getProject(), child, myTreeModel); } @Override - protected GroupWrapper createGroupWrapper(Project project, Group group, TreeModel treeModel) { + protected GroupWrapper createGroupWrapper(Project project, @NotNull Group group, TreeModel treeModel) { return new StructureViewGroup(project, group, treeModel); } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java index 4f9c63ea0078..890f2dff4740 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeActionWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,13 +23,14 @@ import com.intellij.openapi.actionSystem.Presentation; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.actionSystem.impl.MenuItemPresentationFactory; import com.intellij.openapi.project.DumbAware; +import org.jetbrains.annotations.NotNull; public class TreeActionWrapper extends ToggleAction implements DumbAware { private final TreeAction myAction; private final TreeActionsOwner myStructureView; - public TreeActionWrapper(TreeAction action, TreeActionsOwner structureView) { + public TreeActionWrapper(@NotNull TreeAction action, @NotNull TreeActionsOwner structureView) { myAction = action; myStructureView = structureView; } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java index 12d35f8f4344..d3af6621739d 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/TreeModelWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,12 +26,13 @@ import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.List; public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel { private final StructureViewModel myModel; private final TreeActionsOwner myStructureView; - public TreeModelWrapper(StructureViewModel model, TreeActionsOwner structureView) { + public TreeModelWrapper(@NotNull StructureViewModel model, @NotNull TreeActionsOwner structureView) { myModel = model; myStructureView = structureView; } @@ -45,41 +46,43 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel @Override @NotNull public Grouper[] getGroupers() { - ArrayList<TreeAction> filtered = filterActive(myModel.getGroupers()); + List<Grouper> filtered = filterActive(myModel.getGroupers()); return filtered.toArray(new Grouper[filtered.size()]); } - private ArrayList<TreeAction> filterActive(TreeAction[] actions) { - ArrayList<TreeAction> filtered = new ArrayList<TreeAction>(); - for (TreeAction action : actions) { + @NotNull + private <T extends TreeAction> List<T> filterActive(@NotNull T[] actions) { + List<T> filtered = new ArrayList<T>(); + for (T action : actions) { if (isFiltered(action)) filtered.add(action); } return filtered; } - private ArrayList<NodeProvider> filterProviders(Collection<NodeProvider> actions) { - ArrayList<NodeProvider> filtered = new ArrayList<NodeProvider>(); + @NotNull + private List<NodeProvider> filterProviders(@NotNull Collection<NodeProvider> actions) { + List<NodeProvider> filtered = new ArrayList<NodeProvider>(); for (NodeProvider action : actions) { if (isFiltered(action)) filtered.add(action); } return filtered; } - private boolean isFiltered(TreeAction action) { + private boolean isFiltered(@NotNull TreeAction action) { return action instanceof Sorter && !((Sorter)action).isVisible() || myStructureView.isActionActive(action.getName()); } @Override @NotNull public Sorter[] getSorters() { - ArrayList<TreeAction> filtered = filterActive(myModel.getSorters()); + List<Sorter> filtered = filterActive(myModel.getSorters()); return filtered.toArray(new Sorter[filtered.size()]); } @Override @NotNull public Filter[] getFilters() { - ArrayList<TreeAction> filtered = filterActive(myModel.getFilters()); + List<Filter> filtered = filterActive(myModel.getFilters()); return filtered.toArray(new Filter[filtered.size()]); } @@ -97,27 +100,24 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel return Collections.emptyList(); } - public static boolean isActive(final TreeAction action, final TreeActionsOwner actionsOwner) { + public static boolean isActive(@NotNull TreeAction action, @NotNull TreeActionsOwner actionsOwner) { if (shouldRevert(action)) { return !actionsOwner.isActionActive(action.getName()); } - else { - if (action instanceof Sorter && !((Sorter)action).isVisible()) return true; - return actionsOwner.isActionActive(action.getName()); - } + return action instanceof Sorter && !((Sorter)action).isVisible() || actionsOwner.isActionActive(action.getName()); } - public static boolean shouldRevert(final TreeAction action) { + public static boolean shouldRevert(@NotNull TreeAction action) { return action instanceof Filter && ((Filter)action).isReverted(); } @Override - public void addEditorPositionListener(FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { myModel.addEditorPositionListener(listener); } @Override - public void removeEditorPositionListener(FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { myModel.removeEditorPositionListener(listener); } @@ -132,12 +132,12 @@ public class TreeModelWrapper implements StructureViewModel, ProvidingTreeModel } @Override - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { myModel.addModelListener(modelListener); } @Override - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { myModel.removeModelListener(modelListener); } diff --git a/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java b/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java index 17c19314a5e7..2698f894cd7b 100644 --- a/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java +++ b/platform/lang-impl/src/com/intellij/ide/todo/nodes/ToDoRootNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +21,6 @@ import com.intellij.ide.todo.ToDoSummary; import com.intellij.ide.todo.TodoTreeBuilder; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java index 9e171704605c..c3ebb42dd5ef 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructureDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +46,7 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.psi.util.PsiUtilBase; +import com.intellij.psi.util.PsiUtilCore; import com.intellij.ui.*; import com.intellij.ui.docking.DockManager; import com.intellij.ui.speedSearch.SpeedSearchSupply; @@ -80,9 +80,9 @@ public class FileStructureDialog extends DialogWrapper { @NonNls private static final String ourPropertyKey = "FileStructure.narrowDown"; private boolean myShouldNarrowDown = false; - public FileStructureDialog(StructureViewModel structureViewModel, - @Nullable Editor editor, - Project project, + public FileStructureDialog(@NotNull StructureViewModel structureViewModel, + @NotNull Editor editor, + @NotNull Project project, Navigatable navigatable, @NotNull final Disposable auxDisposable, final boolean applySortAndFilter) { @@ -109,17 +109,17 @@ public class FileStructureDialog extends DialogWrapper { if (psiElement != null) { if (structureViewModel.shouldEnterElement(psiElement)) { - myCommanderPanel.getBuilder().enterElement(psiElement, PsiUtilBase.getVirtualFile(psiElement)); + myCommanderPanel.getBuilder().enterElement(psiElement, PsiUtilCore.getVirtualFile(psiElement)); } else { - myCommanderPanel.getBuilder().selectElement(psiElement, PsiUtilBase.getVirtualFile(psiElement)); + myCommanderPanel.getBuilder().selectElement(psiElement, PsiUtilCore.getVirtualFile(psiElement)); } } Disposer.register(myDisposable, auxDisposable); } - protected PsiFile getPsiFile(final Project project) { + protected PsiFile getPsiFile(@NotNull Project project) { return PsiDocumentManager.getInstance(project).getPsiFile(myEditor.getDocument()); } @@ -189,7 +189,8 @@ public class FileStructureDialog extends DialogWrapper { ProjectListBuilder projectListBuilder = new ProjectListBuilder(myProject, myCommanderPanel, myTreeStructure, null, showRoot) { @Override protected boolean shouldEnterSingleTopLevelElement(Object rootChild) { - return myBaseTreeModel.shouldEnterElement(((StructureViewTreeElement)((AbstractTreeNode)rootChild).getValue()).getValue()); + Object element = ((StructureViewTreeElement)((AbstractTreeNode)rootChild).getValue()).getValue(); + return myBaseTreeModel.shouldEnterElement(element); } @Override @@ -283,8 +284,7 @@ public class FileStructureDialog extends DialogWrapper { if (text == null) return; - Shortcut[] shortcuts = action instanceof FileStructureFilter ? - ((FileStructureFilter)action).getShortcut() : ((FileStructureNodeProvider)action).getShortcut(); + Shortcut[] shortcuts = FileStructurePopup.extractShortcutFor(action); final JCheckBox chkFilter = new JCheckBox(); @@ -311,7 +311,7 @@ public class FileStructureDialog extends DialogWrapper { boolean oldNarrowDown = myShouldNarrowDown; myShouldNarrowDown = false; try { - builder.enterElement(currentParent, PsiUtilBase.getVirtualFile(currentParent)); + builder.enterElement(currentParent, PsiUtilCore.getVirtualFile(currentParent)); } finally { myShouldNarrowDown = oldNarrowDown; @@ -321,7 +321,7 @@ public class FileStructureDialog extends DialogWrapper { } if (SpeedSearchBase.hasActiveSpeedSearch(myCommanderPanel.getList())) { - final SpeedSearchSupply supply = SpeedSearchBase.getSupply(myCommanderPanel.getList()); + final SpeedSearchSupply supply = SpeedSearchSupply.getSupply(myCommanderPanel.getList()); if (supply != null && supply.isPopupActive()) supply.refreshSelection(); } } diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java index 176e1b7c7a22..f260c732adf5 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java +++ b/platform/lang-impl/src/com/intellij/ide/util/FileStructurePopup.java @@ -43,6 +43,7 @@ import com.intellij.openapi.editor.Editor; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.TextEditor; import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory; +import com.intellij.openapi.keymap.KeymapManager; import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopup; @@ -713,8 +714,7 @@ public class FileStructurePopup implements Disposable { if (text == null) return; - Shortcut[] shortcuts = action instanceof FileStructureFilter ? - ((FileStructureFilter)action).getShortcut() : ((FileStructureNodeProvider)action).getShortcut(); + Shortcut[] shortcuts = extractShortcutFor(action); final JCheckBox chkFilter = new JCheckBox(); @@ -783,10 +783,20 @@ public class FileStructurePopup implements Disposable { myCheckBoxes.put(action.getClass(), chkFilter); } + @NotNull + static Shortcut[] extractShortcutFor(@NotNull TreeAction action) { + if (action instanceof ActionShortcutProvider) { + String actionId = ((ActionShortcutProvider)action).getActionIdForShortcut(); + return KeymapManager.getInstance().getActiveKeymap().getShortcuts(actionId); + } + return action instanceof FileStructureFilter ? + ((FileStructureFilter)action).getShortcut() : ((FileStructureNodeProvider)action).getShortcut(); + } + private static boolean getDefaultValue(TreeAction action) { if (action instanceof PropertyOwner) { final String propertyName = ((PropertyOwner)action).getPropertyName(); - return PropertiesComponent.getInstance().getBoolean(getPropertyName(propertyName), false); + return PropertiesComponent.getInstance().getBoolean(TreeStructureUtil.getPropertyName(propertyName), false); } return false; @@ -795,15 +805,10 @@ public class FileStructurePopup implements Disposable { private static void saveState(TreeAction action, boolean state) { if (action instanceof PropertyOwner) { final String propertyName = ((PropertyOwner)action).getPropertyName(); - PropertiesComponent.getInstance().setValue(getPropertyName(propertyName), Boolean.toString(state)); + PropertiesComponent.getInstance().setValue(TreeStructureUtil.getPropertyName(propertyName), Boolean.toString(state)); } } - @NonNls - public static String getPropertyName(String propertyName) { - return propertyName + ".file.structure.state"; - } - public void setTitle(String title) { myTitle = title; } diff --git a/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java b/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java index ca4c13626095..ac656636323d 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.java +++ b/platform/lang-impl/src/com/intellij/ide/util/StructureViewCompositeModel.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,11 +65,13 @@ public class StructureViewCompositeModel extends StructureViewModelBase implemen return file.canNavigateToSource(); } + @NotNull @Override public ItemPresentation getPresentation() { return file.getPresentation(); } + @NotNull @Override public TreeElement[] getChildren() { ArrayList<TreeElement> elements = new ArrayList<TreeElement>(); @@ -127,6 +129,7 @@ public class StructureViewCompositeModel extends StructureViewModelBase implemen return file.canNavigateToSource(); } + @NotNull @Override public ItemPresentation getPresentation() { return new ItemPresentation() { @@ -150,6 +153,7 @@ public class StructureViewCompositeModel extends StructureViewModelBase implemen }; } + @NotNull @Override public TreeElement[] getChildren() { return view.structureView.getTreeModel().getRoot().getChildren(); diff --git a/platform/lang-impl/src/com/intellij/injected/editor/CaretModelWindow.java b/platform/lang-impl/src/com/intellij/injected/editor/CaretModelWindow.java index a3e4a80aa756..cee529aecccf 100644 --- a/platform/lang-impl/src/com/intellij/injected/editor/CaretModelWindow.java +++ b/platform/lang-impl/src/com/intellij/injected/editor/CaretModelWindow.java @@ -26,9 +26,7 @@ import com.intellij.openapi.util.TextRange; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; +import java.util.*; /** * @author Alexey @@ -37,6 +35,7 @@ public class CaretModelWindow implements CaretModel { private final CaretModel myDelegate; private final EditorEx myHostEditor; private final EditorWindow myEditorWindow; + private final Map<Caret, InjectedCaret> myInjectedCaretMap = new WeakHashMap<Caret, InjectedCaret>(); public CaretModelWindow(CaretModel delegate, EditorWindow editorWindow) { myDelegate = delegate; @@ -166,9 +165,9 @@ public class CaretModelWindow implements CaretModel { @NotNull @Override - public Collection<Caret> getAllCarets() { - Collection<Caret> hostCarets = myDelegate.getAllCarets(); - Collection<Caret> carets = new ArrayList<Caret>(hostCarets.size()); + public List<Caret> getAllCarets() { + List<Caret> hostCarets = myDelegate.getAllCarets(); + List<Caret> carets = new ArrayList<Caret>(hostCarets.size()); for (Caret hostCaret : hostCarets) { carets.add(createInjectedCaret(hostCaret)); } @@ -205,7 +204,7 @@ public class CaretModelWindow implements CaretModel { } @Override - public void setCarets(@NotNull List<LogicalPosition> caretPositions, @NotNull List<? extends Segment> selections) { + public void setCaretsAndSelections(@NotNull List<LogicalPosition> caretPositions, @NotNull List<? extends Segment> selections) { List<LogicalPosition> convertedPositions = new ArrayList<LogicalPosition>(caretPositions); for (LogicalPosition position : caretPositions) { convertedPositions.add(myEditorWindow.injectedToHost(position)); @@ -215,11 +214,21 @@ public class CaretModelWindow implements CaretModel { convertedSelections.add(new TextRange(myEditorWindow.getDocument().injectedToHost(selection.getStartOffset()), myEditorWindow.getDocument().injectedToHost(selection.getEndOffset()))); } - myDelegate.setCarets(convertedPositions, convertedSelections); + myDelegate.setCaretsAndSelections(convertedPositions, convertedSelections); } private InjectedCaret createInjectedCaret(Caret caret) { - return caret == null ? null : new InjectedCaret(myEditorWindow, caret); + if (caret == null) { + return null; + } + synchronized (myInjectedCaretMap) { + InjectedCaret injectedCaret = myInjectedCaretMap.get(caret); + if (injectedCaret == null) { + injectedCaret = new InjectedCaret(myEditorWindow, caret); + myInjectedCaretMap.put(caret, injectedCaret); + } + return injectedCaret; + } } @Override diff --git a/platform/lang-impl/src/com/intellij/injected/editor/EditorWindowImpl.java b/platform/lang-impl/src/com/intellij/injected/editor/EditorWindowImpl.java index 8cb55714ef64..4b0d9d158385 100644 --- a/platform/lang-impl/src/com/intellij/injected/editor/EditorWindowImpl.java +++ b/platform/lang-impl/src/com/intellij/injected/editor/EditorWindowImpl.java @@ -39,7 +39,6 @@ import com.intellij.openapi.editor.impl.EditorImpl; import com.intellij.openapi.editor.impl.SoftWrapModelImpl; import com.intellij.openapi.editor.impl.TextDrawingCallback; import com.intellij.openapi.editor.impl.softwrap.SoftWrapAppliancePlaces; -import com.intellij.openapi.editor.markup.MarkupModel; import com.intellij.openapi.editor.markup.TextAttributes; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Disposer; @@ -57,7 +56,7 @@ import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; import java.beans.PropertyChangeListener; -import java.util.*; +import java.util.Iterator; import java.util.List; /** @@ -109,7 +108,7 @@ public class EditorWindowImpl extends UserDataHolderBase implements EditorWindow myOneLine = oneLine; myCaretModelDelegate = new CaretModelWindow(myDelegate.getCaretModel(), this); mySelectionModelDelegate = new SelectionModelWindow(myDelegate, myDocumentWindow,this); - myMarkupModelDelegate = new MarkupModelWindow((MarkupModelEx)myDelegate.getMarkupModel(), myDocumentWindow); + myMarkupModelDelegate = new MarkupModelWindow(myDelegate.getMarkupModel(), myDocumentWindow); myFoldingModelWindow = new FoldingModelWindow(delegate.getFoldingModel(), documentWindow, this); mySoftWrapModel = new SoftWrapModelImpl(this); Disposer.register(myDocumentWindow, mySoftWrapModel); @@ -249,7 +248,7 @@ public class EditorWindowImpl extends UserDataHolderBase implements EditorWindow @Override @NotNull - public MarkupModel getMarkupModel() { + public MarkupModelEx getMarkupModel() { return myMarkupModelDelegate; } diff --git a/platform/lang-impl/src/com/intellij/mock/MockFileManager.java b/platform/lang-impl/src/com/intellij/mock/MockFileManager.java index f5cb2e19c236..2197dff2b9fa 100644 --- a/platform/lang-impl/src/com/intellij/mock/MockFileManager.java +++ b/platform/lang-impl/src/com/intellij/mock/MockFileManager.java @@ -42,8 +42,8 @@ public class MockFileManager implements FileManager { @Override @NotNull - public FileViewProvider createFileViewProvider(@NotNull final VirtualFile file, final boolean physical) { - return new SingleRootFileViewProvider(myManager, file, physical); + public FileViewProvider createFileViewProvider(@NotNull final VirtualFile file, final boolean eventSystemEnabled) { + return new SingleRootFileViewProvider(myManager, file, eventSystemEnabled); } public MockFileManager(final PsiManagerEx manager) { diff --git a/platform/lang-impl/src/com/intellij/mock/MockPsiManager.java b/platform/lang-impl/src/com/intellij/mock/MockPsiManager.java index b69a8d389ad0..c1572ccb7941 100644 --- a/platform/lang-impl/src/com/intellij/mock/MockPsiManager.java +++ b/platform/lang-impl/src/com/intellij/mock/MockPsiManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ public class MockPsiManager extends PsiManagerEx { } @Override - public void addPsiTreeChangeListener(@NotNull PsiTreeChangeListener listener, Disposable parentDisposable) { + public void addPsiTreeChangeListener(@NotNull PsiTreeChangeListener listener, @NotNull Disposable parentDisposable) { } @Override diff --git a/platform/lang-impl/src/com/intellij/navigation/DirectoryPresentationProvider.java b/platform/lang-impl/src/com/intellij/navigation/DirectoryPresentationProvider.java index ca31c0819023..2142bf69c431 100644 --- a/platform/lang-impl/src/com/intellij/navigation/DirectoryPresentationProvider.java +++ b/platform/lang-impl/src/com/intellij/navigation/DirectoryPresentationProvider.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. @@ -27,12 +27,13 @@ import com.intellij.openapi.util.IconLoader; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; import com.intellij.util.PlatformIcons; +import org.jetbrains.annotations.NotNull; import javax.swing.*; public class DirectoryPresentationProvider implements ItemPresentationProvider<PsiDirectory> { @Override - public ItemPresentation getPresentation(final PsiDirectory directory) { + public ItemPresentation getPresentation(@NotNull final PsiDirectory directory) { final VirtualFile vFile = directory.getVirtualFile(); final Project project = directory.getProject(); final String locationString = vFile.getPath(); diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java new file mode 100644 index 000000000000..81a7851da874 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/SelectNextOccurrenceAction.java @@ -0,0 +1,151 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.actions; + +import com.intellij.codeInsight.editorActions.SelectWordUtil; +import com.intellij.codeInsight.hint.HintManager; +import com.intellij.codeInsight.hint.HintManagerImpl; +import com.intellij.codeInsight.hint.HintUtil; +import com.intellij.find.FindBundle; +import com.intellij.find.FindManager; +import com.intellij.find.FindModel; +import com.intellij.find.FindResult; +import com.intellij.openapi.editor.EditorLastActionTracker; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.ScrollType; +import com.intellij.openapi.editor.actionSystem.EditorAction; +import com.intellij.openapi.editor.actionSystem.EditorActionHandler; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Key; +import com.intellij.openapi.util.TextRange; +import com.intellij.ui.LightweightHint; +import org.jetbrains.annotations.Nullable; + +public class SelectNextOccurrenceAction extends EditorAction { + private static final Key<Boolean> NOT_FOUND = Key.create("select.next.occurence.not.found"); + private static final Key<Boolean> WHOLE_WORDS = Key.create("select.next.occurence.whole.words"); + + protected SelectNextOccurrenceAction() { + super(new Handler()); + } + + static class Handler extends EditorActionHandler { + @Override + public boolean isEnabled(Editor editor, DataContext dataContext) { + return super.isEnabled(editor, dataContext) && editor.getProject() != null && editor.getCaretModel().supportsMultipleCarets(); + } + + @Override + public void execute(Editor editor, @Nullable Caret c, DataContext dataContext) { + Caret caret = c == null ? editor.getCaretModel().getPrimaryCaret() : c; + TextRange wordSelectionRange = SelectWordUtil.getWordSelectionRange(editor.getDocument().getCharsSequence(), + caret.getOffset(), + SelectWordUtil.JAVA_IDENTIFIER_PART_CONDITION); + boolean notFoundPreviously = getAndResetNotFoundStatus(editor); + boolean wholeWordSearch = isWholeWordSearch(editor); + if (caret.hasSelection()) { + Project project = editor.getProject(); + String selectedText = caret.getSelectedText(); + if (project == null || selectedText == null) { + return; + } + FindManager findManager = FindManager.getInstance(project); + + FindModel model = new FindModel(); + model.setStringToFind(caret.getSelectedText()); + model.setCaseSensitive(true); + model.setWholeWordsOnly(wholeWordSearch); + + int searchStartOffset = notFoundPreviously ? 0 : caret.getSelectionEnd(); + FindResult findResult = findManager.findString(editor.getDocument().getCharsSequence(), searchStartOffset, model); + if (findResult.isStringFound()) { + int newCaretOffset = caret.getOffset() - caret.getSelectionStart() + findResult.getStartOffset(); + EditorActionUtil.makePositionVisible(editor, newCaretOffset); + Caret newCaret = editor.getCaretModel().addCaret(editor.offsetToVisualPosition(newCaretOffset)); + if (newCaret == null) { + // this means that the found occurence is already selected + if (notFoundPreviously) { + setNotFoundStatus(editor); // to make sure we won't show hint anymore if there are no more occurrences + } + } + else { + setSelection(editor, newCaret, findResult); + } + } + else { + setNotFoundStatus(editor); + showHint(editor); + } + } + else { + if (wordSelectionRange == null) { + return; + } + setSelection(editor, caret, wordSelectionRange); + setWholeWordSearch(editor, true); + } + editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); + } + + private static void setSelection(Editor editor, Caret caret, TextRange selectionRange) { + EditorActionUtil.makePositionVisible(editor, selectionRange.getStartOffset()); + EditorActionUtil.makePositionVisible(editor, selectionRange.getEndOffset()); + caret.setSelection(selectionRange.getStartOffset(), selectionRange.getEndOffset()); + } + + + private static void showHint(final Editor editor) { + String message = FindBundle.message("select.next.occurence.not.found.message"); + final LightweightHint hint = new LightweightHint(HintUtil.createInformationLabel(message)); + HintManagerImpl.getInstanceImpl().showEditorHint(hint, + editor, + HintManager.UNDER, + HintManager.HIDE_BY_TEXT_CHANGE | HintManager.HIDE_BY_SCROLLING, + 0, + false); + } + + static boolean getAndResetNotFoundStatus(Editor editor) { + boolean status = editor.getUserData(NOT_FOUND) != null; + editor.putUserData(NOT_FOUND, null); + return status && isRepeatedActionInvocation(); + } + + private static void setNotFoundStatus(Editor editor) { + editor.putUserData(NOT_FOUND, Boolean.TRUE); + } + + private static boolean isWholeWordSearch(Editor editor) { + if (!isRepeatedActionInvocation()) { + editor.putUserData(WHOLE_WORDS, null); + } + Boolean value = editor.getUserData(WHOLE_WORDS); + return value != null; + } + + private static void setWholeWordSearch(Editor editor, boolean isWholeWordSearch) { + editor.putUserData(WHOLE_WORDS, isWholeWordSearch); + } + + private static boolean isRepeatedActionInvocation() { + String lastActionId = EditorLastActionTracker.getInstance().getLastActionId(); + return IdeActions.ACTION_SELECT_NEXT_OCCURENCE.equals(lastActionId) || IdeActions.ACTION_UNSELECT_LAST_OCCURENCE.equals(lastActionId); + } + } +} diff --git a/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectLastOccurrenceAction.java b/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectLastOccurrenceAction.java new file mode 100644 index 000000000000..192e41cdfdb6 --- /dev/null +++ b/platform/lang-impl/src/com/intellij/openapi/editor/actions/UnselectLastOccurrenceAction.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.openapi.editor.actions; + +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.ScrollType; +import com.intellij.openapi.editor.actionSystem.EditorAction; +import com.intellij.openapi.editor.actionSystem.EditorActionHandler; +import org.jetbrains.annotations.Nullable; + +public class UnselectLastOccurrenceAction extends EditorAction { + protected UnselectLastOccurrenceAction() { + super(new Handler()); + } + + private static class Handler extends EditorActionHandler { + @Override + public boolean isEnabled(Editor editor, DataContext dataContext) { + return super.isEnabled(editor, dataContext) && editor.getCaretModel().supportsMultipleCarets(); + } + + @Override + public void execute(Editor editor, @Nullable Caret caret, DataContext dataContext) { + if (editor.getCaretModel().getAllCarets().size() > 1) { + editor.getCaretModel().removeCaret(editor.getCaretModel().getPrimaryCaret()); + } + else { + editor.getSelectionModel().removeSelection(); + } + SelectNextOccurrenceAction.Handler.getAndResetNotFoundStatus(editor); + editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE); + } + } +} diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java index 0b710b3a39ad..420ed2931d64 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/EnforcedPlainTextFileTypeManager.java @@ -17,9 +17,6 @@ package com.intellij.openapi.file.exclude; import com.intellij.openapi.application.ApplicationManager; 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.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeManager; import com.intellij.openapi.fileTypes.FileTypes; @@ -28,49 +25,51 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.project.ProjectManagerListener; import com.intellij.openapi.roots.ex.ProjectRootManagerEx; -import com.intellij.openapi.roots.impl.DirectoryIndex; import com.intellij.openapi.util.EmptyRunnable; +import com.intellij.openapi.util.Ref; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.WeakList; +import com.intellij.util.containers.ConcurrentHashMap; import com.intellij.util.indexing.FileBasedIndex; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; /** - * Maintains a list of files marked as plain text in a local environment (configuration). Every time a project is loaded/open, it reads - * files marked as plain text from a project into local environment (configuration). User actions (mark/unmark as plain text) are - * synchronized between local and project configurations. + * Retrieves plain text file type from open projects' configurations. * * @author Rustam Vishnyakov */ -@State(name = "EnforcedPlainTextFileTypeManager", storages = {@Storage( file = StoragePathMacros.APP_CONFIG + "/plainTextFiles.xml")}) -public class EnforcedPlainTextFileTypeManager extends PersistentFileSetManager implements ProjectManagerListener { - private final Collection<Project> myProcessedProjects = new WeakList<Project>(); - private boolean myNeedsSync = true; +public class EnforcedPlainTextFileTypeManager implements ProjectManagerListener { + private final Map<Project, Collection<VirtualFile>> myPlainTextFileSets = new ConcurrentHashMap<Project, Collection<VirtualFile>>(); + private final Ref<Boolean> mySetsInitialized = new Ref<Boolean>(false); public EnforcedPlainTextFileTypeManager() { ProjectManager.getInstance().addProjectManagerListener(this); } public boolean isMarkedAsPlainText(VirtualFile file) { - if (myNeedsSync) { - myNeedsSync = !syncWithOpenProjects(); + if (file.isDirectory()) return false; + synchronized (mySetsInitialized) { + if (!mySetsInitialized.get()) { + initPlainTextFileSets(); + mySetsInitialized.set(true); + } } - return containsFile(file); + for (Project project : myPlainTextFileSets.keySet()) { + Collection<VirtualFile> projectSet = myPlainTextFileSets.get(project); + if (projectSet != null && projectSet.contains(file)) return true; + } + return false; } - private boolean syncWithOpenProjects() { - boolean success = true; + private void initPlainTextFileSets() { Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project openProject : openProjects) { - if (!myProcessedProjects.contains(openProject)) { - if (!syncWithProject(openProject)) success = false; - } + addProjectPlainTextFiles(openProject); } - return success; } public static boolean isApplicableFor(@NotNull VirtualFile file) { @@ -80,25 +79,20 @@ public class EnforcedPlainTextFileTypeManager extends PersistentFileSetManager i } public void markAsPlainText(VirtualFile... files) { - List<VirtualFile> filesToSync = new ArrayList<VirtualFile>(); - for (VirtualFile file : files) { - if (addFile(file)) { - filesToSync.add(file); - FileBasedIndex.getInstance().requestReindex(file); - } - } - fireRootsChanged(filesToSync, true); + setPlainTextStatus(true, files); + } + + public void resetOriginalFileType(VirtualFile... files) { + setPlainTextStatus(false, files); } - public void unmarkPlainText(VirtualFile... files) { + public void setPlainTextStatus(boolean isPlainText, VirtualFile... files) { List<VirtualFile> filesToSync = new ArrayList<VirtualFile>(); for (VirtualFile file : files) { - if (removeFile(file)) { - filesToSync.add(file); - FileBasedIndex.getInstance().requestReindex(file); - } + filesToSync.add(file); + FileBasedIndex.getInstance().requestReindex(file); } - fireRootsChanged(filesToSync, false); + fireRootsChanged(filesToSync, isPlainText); } private static void fireRootsChanged(final Collection<VirtualFile> files, final boolean isAdded) { @@ -133,7 +127,7 @@ public class EnforcedPlainTextFileTypeManager extends PersistentFileSetManager i @Override public void projectOpened(Project project) { - syncWithProject(project); + addProjectPlainTextFiles(project); } @Override @@ -143,27 +137,19 @@ public class EnforcedPlainTextFileTypeManager extends PersistentFileSetManager i @Override public void projectClosed(Project project) { - myProcessedProjects.remove(project); + myPlainTextFileSets.remove(project); } @Override public void projectClosing(Project project) { } - private boolean syncWithProject(Project project) { - if (project.isDisposed()) return false; - ProjectPlainTextFileTypeManager projectPlainTextFileTypeManager = ProjectPlainTextFileTypeManager.getInstance(project); - if (projectPlainTextFileTypeManager == null) return true; - for (VirtualFile file : projectPlainTextFileTypeManager.getFiles()) { - addFile(file); - } - if (!DirectoryIndex.getInstance(project).isInitialized()) return false; - for (VirtualFile file : getFiles()) { - if (projectPlainTextFileTypeManager.hasProjectContaining(file)) { - projectPlainTextFileTypeManager.addFile(file); + private void addProjectPlainTextFiles(@NotNull Project project) { + if (!project.isDisposed()) { + ProjectPlainTextFileTypeManager projectPlainTextFileTypeManager = ProjectPlainTextFileTypeManager.getInstance(project); + if (projectPlainTextFileTypeManager != null) { + myPlainTextFileSets.put(project, projectPlainTextFileTypeManager.getFiles()); } } - myProcessedProjects.add(project); - return true; } } diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsOriginalTypeAction.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsOriginalTypeAction.java index 946dd9b93b88..c4e9c1a8ea31 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsOriginalTypeAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsOriginalTypeAction.java @@ -42,7 +42,7 @@ public class MarkAsOriginalTypeAction extends AnAction { } EnforcedPlainTextFileTypeManager typeManager = EnforcedPlainTextFileTypeManager.getInstance(); assert typeManager != null; - typeManager.unmarkPlainText(filesToUnmark.toArray(new VirtualFile[filesToUnmark.size()])); + typeManager.resetOriginalFileType(filesToUnmark.toArray(new VirtualFile[filesToUnmark.size()])); } @Override diff --git a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsPlainTextAction.java b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsPlainTextAction.java index 787bd43a608f..7af431c561b5 100644 --- a/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsPlainTextAction.java +++ b/platform/lang-impl/src/com/intellij/openapi/file/exclude/ui/MarkAsPlainTextAction.java @@ -19,7 +19,6 @@ import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeFactory; import com.intellij.openapi.file.exclude.EnforcedPlainTextFileTypeManager; import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; diff --git a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java index beb9ee21bc93..79ac777a6fd8 100644 --- a/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/TestEditorManagerImpl.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. @@ -485,6 +485,7 @@ public class TestEditorManagerImpl extends FileEditorManagerEx implements Applic return null; } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { return new ActionCallback.Done(); diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java index eafc1cf964ef..f32a372d11ed 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ModuleImpl.java @@ -340,7 +340,7 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx private class MyVirtualFileListener extends VirtualFileAdapter { @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { if (!isModuleAdded) return; final Object requestor = event.getRequestor(); if (MODULE_RENAMING_REQUESTOR.equals(requestor)) return; @@ -379,7 +379,7 @@ public class ModuleImpl extends PlatformComponentManagerImpl implements ModuleEx } @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { final VirtualFile oldParent = event.getOldParent(); final VirtualFile newParent = event.getNewParent(); final String dirName = event.getFileName(); diff --git a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkTableImpl.java b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkTableImpl.java index c56f397cc1f1..d5becac99ede 100644 --- a/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkTableImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/projectRoots/impl/ProjectJdkTableImpl.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. @@ -66,7 +66,7 @@ public class ProjectJdkTableImpl extends ProjectJdkTable implements PersistentSt // support external changes to jdk libraries (Endorsed Standards Override) VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() { @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { updateJdks(event.getFile()); } diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java index d0541e67200c..0979008f0ec7 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/DirectoryIndexImpl.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. @@ -178,7 +178,7 @@ public class DirectoryIndexImpl extends DirectoryIndex { private class MyVirtualFileListener extends VirtualFileAdapter implements BulkFileListener { @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { VirtualFile file = event.getFile(); if (!file.isDirectory()) return; @@ -272,7 +272,7 @@ public class DirectoryIndexImpl extends DirectoryIndex { private final Key<int[]> FILES_TO_RELEASE_KEY = Key.create("DirectoryIndexImpl.MyVirtualFileListener.FILES_TO_RELEASE_KEY"); @Override - public void beforeFileDeletion(VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull VirtualFileEvent event) { VirtualFile file = event.getFile(); if (!file.isDirectory()) return; if (myState.getInfo(((NewVirtualFile)file).getId()) == null) return; @@ -297,7 +297,7 @@ public class DirectoryIndexImpl extends DirectoryIndex { } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { VirtualFile file = event.getFile(); final int[] list = file.getUserData(FILES_TO_RELEASE_KEY); if (list == null) return; @@ -326,7 +326,7 @@ public class DirectoryIndexImpl extends DirectoryIndex { } @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { VirtualFile file = event.getFile(); if (file.isDirectory()) { doInitialize(); @@ -335,7 +335,7 @@ public class DirectoryIndexImpl extends DirectoryIndex { } @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) { VirtualFile file = event.getFile(); if (file.isDirectory()) { diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java index 3f75f7f28e3b..bff786fffd58 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java @@ -58,7 +58,7 @@ import java.util.Set; public class ProjectRootManagerComponent extends ProjectRootManagerImpl { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.ProjectManagerComponent"); private static final boolean ourScheduleCacheUpdateInDumbMode = SystemProperties.getBooleanProperty( - "idea.schedule.cache.update.in.dumb.mode", ApplicationManager.getApplication().isInternal()); + "idea.schedule.cache.update.in.dumb.mode", ApplicationManager.getApplication().isInternal() || ApplicationManager.getApplication().isEAP()); private boolean myPointerChangesDetected = false; private int myInsideRefresh = 0; private boolean myLargeVfsUpdateDetected; diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java index 047a5ab4cc66..b1f034d2dcb2 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/storage/ClasspathStorage.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. @@ -86,7 +86,7 @@ public class ClasspathStorage implements StateStorage { final Listener listener = messageBus.syncPublisher(STORAGE_TOPIC); virtualFileTracker.addTracker(file.getUrl(), new VirtualFileAdapter() { @Override - public void contentsChanged(final VirtualFileEvent event) { + public void contentsChanged(@NotNull final VirtualFileEvent event) { listener.storageFileChanged(event, ClasspathStorage.this); } }, true, module); diff --git a/platform/lang-impl/src/com/intellij/platform/PlatformProjectViewStructureProvider.java b/platform/lang-impl/src/com/intellij/platform/PlatformProjectViewStructureProvider.java index d0cccf1844f7..ab08ce6d9091 100644 --- a/platform/lang-impl/src/com/intellij/platform/PlatformProjectViewStructureProvider.java +++ b/platform/lang-impl/src/com/intellij/platform/PlatformProjectViewStructureProvider.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. @@ -27,6 +27,7 @@ import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDirectory; +import org.jetbrains.annotations.NotNull; import java.util.ArrayList; import java.util.Collection; @@ -41,8 +42,9 @@ public class PlatformProjectViewStructureProvider implements TreeStructureProvid myProject = project; } + @NotNull @Override - public Collection<AbstractTreeNode> modify(final AbstractTreeNode parent, final Collection<AbstractTreeNode> children, final ViewSettings settings) { + public Collection<AbstractTreeNode> modify(@NotNull final AbstractTreeNode parent, @NotNull final Collection<AbstractTreeNode> children, final ViewSettings settings) { if (parent instanceof PsiDirectoryNode) { final VirtualFile vFile = ((PsiDirectoryNode)parent).getVirtualFile(); if (vFile != null && Comparing.equal(ProjectFileIndex.SERVICE.getInstance(myProject).getContentRootForFile(vFile), vFile)) { diff --git a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java index 1d9ef8c6525b..bf306856c2c3 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/file/impl/PsiVFSListener.java @@ -22,6 +22,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.FileDocumentManagerAdapter; +import com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeEvent; import com.intellij.openapi.fileTypes.FileTypeListener; @@ -33,7 +34,7 @@ import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.vfs.*; import com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter; import com.intellij.psi.*; -import com.intellij.psi.impl.PsiDocumentManagerImpl; +import com.intellij.psi.impl.PsiDocumentManagerBase; import com.intellij.psi.impl.PsiManagerImpl; import com.intellij.psi.impl.PsiTreeChangeEventImpl; import com.intellij.psi.impl.smartPointers.SmartPointerManagerImpl; @@ -87,7 +88,7 @@ public class PsiVFSListener extends VirtualFileAdapter { } @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { final VirtualFile vFile = event.getFile(); ApplicationManager.getApplication().runWriteAction( @@ -124,7 +125,7 @@ public class PsiVFSListener extends VirtualFileAdapter { } @Override - public void beforeFileDeletion(VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull VirtualFileEvent event) { final VirtualFile vFile = event.getFile(); VirtualFile parent = vFile.getParent(); @@ -159,7 +160,7 @@ public class PsiVFSListener extends VirtualFileAdapter { } @Override - public void fileDeleted(final VirtualFileEvent event) { + public void fileDeleted(@NotNull final VirtualFileEvent event) { final VirtualFile vFile = event.getFile(); VirtualFile parent = event.getParent(); @@ -202,7 +203,7 @@ public class PsiVFSListener extends VirtualFileAdapter { } @Override - public void beforePropertyChange(final VirtualFilePropertyEvent event) { + public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) { final VirtualFile vFile = event.getFile(); final String propertyName = event.getPropertyName(); @@ -301,7 +302,7 @@ public class PsiVFSListener extends VirtualFileAdapter { } @Override - public void propertyChanged(final VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull final VirtualFilePropertyEvent event) { final String propertyName = event.getPropertyName(); final VirtualFile vFile = event.getFile(); @@ -318,29 +319,7 @@ public class PsiVFSListener extends VirtualFileAdapter { final PsiDirectory parentDir = getCachedDirectory(parent); if (FileContentUtilCore.FORCE_RELOAD_REQUESTOR.equals(event.getRequestor())) { - FileViewProvider viewProvider = myFileManager.createFileViewProvider(vFile, true); - myFileManager.setViewProvider(vFile, viewProvider); - PsiFile newPsiFile = myManager.findFile(vFile); - if (newPsiFile == null) { - // psi file here can be null for any custom file with null parent - // that is currently open in a file editor, e.g. db table editor - //LOG.error("null psi file for "+vFile+"; provider: "+viewProvider); - return; - } - if (!viewProvider.isPhysical()) { - Document document = viewProvider.getDocument(); - if (document != null) { - PsiDocumentManagerImpl.cachePsi(document, newPsiFile); - } - } - if (parentDir != null) { - PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager); - treeEvent.setParent(parentDir); - - treeEvent.setOldChild(oldPsiFile); - treeEvent.setNewChild(newPsiFile); - myManager.childReplaced(treeEvent); - } + forceReload(vFile, oldPsiFile, parentDir); return; } @@ -450,8 +429,34 @@ public class PsiVFSListener extends VirtualFileAdapter { ); } + private void forceReload(@NotNull VirtualFile vFile, PsiFile oldPsiFile, PsiDirectory parentDir) { + FileViewProvider viewProvider = myFileManager.createFileViewProvider(vFile, true); + myFileManager.setViewProvider(vFile, viewProvider); + PsiFile newPsiFile = myManager.findFile(vFile); + if (newPsiFile == null) { + // psi file here can be null for any custom file with null parent + // that is currently open in a file editor, e.g. db table editor + //LOG.error("null psi file for "+vFile+"; provider: "+viewProvider); + return; + } + if (!viewProvider.isPhysical()) { + Document document = viewProvider.getDocument(); + if (document != null) { + PsiDocumentManagerBase.cachePsi(document, newPsiFile); + } + } + if (parentDir != null) { + PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager); + treeEvent.setParent(parentDir); + + treeEvent.setOldChild(oldPsiFile); + treeEvent.setNewChild(newPsiFile); + myManager.childReplaced(treeEvent); + } + } + @Override - public void beforeFileMovement(VirtualFileMoveEvent event) { + public void beforeFileMovement(@NotNull VirtualFileMoveEvent event) { final VirtualFile vFile = event.getFile(); final PsiDirectory oldParentDir = myFileManager.findDirectory(event.getOldParent()); @@ -504,7 +509,7 @@ public class PsiVFSListener extends VirtualFileAdapter { } @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { final VirtualFile vFile = event.getFile(); final PsiDirectory oldParentDir = myFileManager.findDirectory(event.getOldParent()); @@ -647,13 +652,16 @@ public class PsiVFSListener extends VirtualFileAdapter { private class MyFileDocumentManagerAdapter extends FileDocumentManagerAdapter { @Override - public void fileWithNoDocumentChanged(@NotNull VirtualFile file) { + public void fileWithNoDocumentChanged(@NotNull final VirtualFile file) { final PsiFile psiFile = myFileManager.getCachedPsiFileInner(file); if (psiFile != null) { ApplicationManager.getApplication().runWriteAction( new ExternalChangeAction() { @Override public void run() { + if (FileDocumentManagerImpl.recomputeFileTypeIfNecessary(file)) { + forceReload(file, psiFile, null); + } myFileManager.reloadFromDisk(psiFile, true); // important to ignore document which might appear already! } } diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java index 8e33511615b0..b44c8183b876 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/PostprocessReformattingAspect.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. @@ -100,7 +100,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { ApplicationManager.getApplication().addApplicationListener(applicationListener, project); } - public void disablePostprocessFormattingInside(final Runnable runnable) { + public void disablePostprocessFormattingInside(@NotNull final Runnable runnable) { disablePostprocessFormattingInside(new NullableComputable<Object>() { @Override public Object compute() { @@ -110,7 +110,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { }); } - public <T> T disablePostprocessFormattingInside(Computable<T> computable) { + public <T> T disablePostprocessFormattingInside(@NotNull Computable<T> computable) { try { myDisabledCounter++; return computable.compute(); @@ -121,7 +121,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { } } - public void postponeFormattingInside(final Runnable runnable) { + public void postponeFormattingInside(@NotNull final Runnable runnable) { postponeFormattingInside(new NullableComputable<Object>() { @Override public Object compute() { @@ -131,7 +131,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { }); } - public <T> T postponeFormattingInside(Computable<T> computable) { + public <T> T postponeFormattingInside(@NotNull Computable<T> computable) { Application application = ApplicationManager.getApplication(); application.assertIsDispatchThread(); try { @@ -170,7 +170,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { } @Override - public void update(final PomModelEvent event) { + public void update(@NotNull final PomModelEvent event) { atomic(new Runnable() { @Override public void run() { @@ -235,15 +235,15 @@ public class PostprocessReformattingAspect implements PomModelAspect { }); } - public void postponedFormatting(final FileViewProvider viewProvider) { + public void postponedFormatting(@NotNull FileViewProvider viewProvider) { postponedFormattingImpl(viewProvider, true); } - public void doPostponedFormatting(final FileViewProvider viewProvider) { + public void doPostponedFormatting(@NotNull FileViewProvider viewProvider) { postponedFormattingImpl(viewProvider, false); } - private void postponedFormattingImpl(final FileViewProvider viewProvider, final boolean check) { + private void postponedFormattingImpl(@NotNull final FileViewProvider viewProvider, final boolean check) { atomic(new Runnable() { @Override public void run() { @@ -302,7 +302,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { list.add(child); } - private void doPostponedFormattingInner(final FileViewProvider key) { + private void doPostponedFormattingInner(@NotNull FileViewProvider key) { final List<ASTNode> astNodes = myReformatElements.remove(key); final Document document = key.getDocument(); // Sort ranges by end offsets so that we won't need any offset adjustment after reformat or reindent @@ -353,7 +353,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { } } - private void checkPsiIsCorrect(final FileViewProvider key) { + private void checkPsiIsCorrect(@NotNull FileViewProvider key) { PsiFile actualPsi = key.getPsi(key.getBaseLanguage()); PsiTreeDebugBuilder treeDebugBuilder = new PsiTreeDebugBuilder().setShowErrorElements(false).setShowWhiteSpaces(false); @@ -375,7 +375,8 @@ public class PostprocessReformattingAspect implements PomModelAspect { } } - private List<PostponedAction> normalizeAndReorderPostponedActions(TreeSet<PostprocessFormattingTask> rangesToProcess, Document document) { + @NotNull + private List<PostponedAction> normalizeAndReorderPostponedActions(@NotNull Set<PostprocessFormattingTask> rangesToProcess, @NotNull Document document) { final List<PostprocessFormattingTask> freeFormattingActions = new ArrayList<PostprocessFormattingTask>(); final List<ReindentTask> indentActions = new ArrayList<ReindentTask>(); @@ -503,9 +504,9 @@ public class PostprocessReformattingAspect implements PomModelAspect { return !(currentTask instanceof ReindentTask); } - private static void createActionsMap(final List<ASTNode> astNodes, - final FileViewProvider provider, - final TreeSet<PostprocessFormattingTask> rangesToProcess) { + private static void createActionsMap(@NotNull List<ASTNode> astNodes, + @NotNull FileViewProvider provider, + @NotNull final TreeSet<PostprocessFormattingTask> rangesToProcess) { final Set<ASTNode> nodesToProcess = new HashSet<ASTNode>(astNodes); final Document document = provider.getDocument(); if (document == null) { @@ -558,7 +559,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { } } - private static void handleReformatMarkers(final FileViewProvider key, final TreeSet<PostprocessFormattingTask> rangesToProcess) { + private static void handleReformatMarkers(@NotNull final FileViewProvider key, @NotNull final Set<PostprocessFormattingTask> rangesToProcess) { final Document document = key.getDocument(); if (document == null) { return; @@ -585,9 +586,9 @@ public class PostprocessReformattingAspect implements PomModelAspect { } } - private static void adjustIndentationInRange(final PsiFile file, - final Document document, - final TextRange[] indents, + private static void adjustIndentationInRange(@NotNull PsiFile file, + @NotNull Document document, + @NotNull TextRange[] indents, final int indentAdjustment) { final CharSequence charsSequence = document.getCharsSequence(); for (final TextRange indent : indents) { @@ -599,13 +600,13 @@ public class PostprocessReformattingAspect implements PomModelAspect { } } - @SuppressWarnings("StatementWithEmptyBody") - private static int getNewIndent(final PsiFile psiFile, final int firstWhitespace) { + private static int getNewIndent(@NotNull PsiFile psiFile, final int firstWhitespace) { final Document document = psiFile.getViewProvider().getDocument(); assert document != null; final int startOffset = document.getLineStartOffset(document.getLineNumber(firstWhitespace)); int endOffset = startOffset; final CharSequence charsSequence = document.getCharsSequence(); + //noinspection StatementWithEmptyBody while (Character.isWhitespace(charsSequence.charAt(endOffset++))) ; final String newIndentStr = charsSequence.subSequence(startOffset, endOffset - 1).toString(); return IndentHelperImpl.getIndent(psiFile.getProject(), psiFile.getFileType(), newIndentStr, true); @@ -615,7 +616,8 @@ public class PostprocessReformattingAspect implements PomModelAspect { return myDisabledCounter > 0; } - private CodeFormatterFacade getFormatterFacade(final FileViewProvider viewProvider) { + @NotNull + private CodeFormatterFacade getFormatterFacade(@NotNull FileViewProvider viewProvider) { final CodeStyleSettings styleSettings = CodeStyleSettingsManager.getSettings(myPsiManager.getProject()); final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myPsiManager.getProject()); final Document document = viewProvider.getDocument(); @@ -672,13 +674,13 @@ public class PostprocessReformattingAspect implements PomModelAspect { } private static class ReformatTask extends PostprocessFormattingTask { - public ReformatTask(RangeMarker rangeMarker) { + public ReformatTask(@NotNull RangeMarker rangeMarker) { super(rangeMarker); } } private static class ReformatWithHeadingWhitespaceTask extends PostprocessFormattingTask { - public ReformatWithHeadingWhitespaceTask(RangeMarker rangeMarker) { + public ReformatWithHeadingWhitespaceTask(@NotNull RangeMarker rangeMarker) { super(rangeMarker); } } @@ -686,7 +688,7 @@ public class PostprocessReformattingAspect implements PomModelAspect { private static class ReindentTask extends PostprocessFormattingTask { private final int myOldIndent; - public ReindentTask(RangeMarker rangeMarker, int oldIndent) { + public ReindentTask(@NotNull RangeMarker rangeMarker, int oldIndent) { super(rangeMarker); myOldIndent = oldIndent; } @@ -697,18 +699,18 @@ public class PostprocessReformattingAspect implements PomModelAspect { } private interface PostponedAction extends Disposable { - void execute(FileViewProvider viewProvider); + void execute(@NotNull FileViewProvider viewProvider); } private class ReformatRangesAction implements PostponedAction { private final FormatTextRanges myRanges; - public ReformatRangesAction(FormatTextRanges ranges) { + public ReformatRangesAction(@NotNull FormatTextRanges ranges) { myRanges = ranges; } @Override - public void execute(FileViewProvider viewProvider) { + public void execute(@NotNull FileViewProvider viewProvider) { final CodeFormatterFacade codeFormatter = getFormatterFacade(viewProvider); codeFormatter.processText(viewProvider.getPsi(viewProvider.getBaseLanguage()), myRanges.ensureNonEmpty(), false); } @@ -721,12 +723,12 @@ public class PostprocessReformattingAspect implements PomModelAspect { private static class ReindentRangesAction implements PostponedAction { private final List<Pair<Integer, RangeMarker>> myRangesToReindent = new ArrayList<Pair<Integer, RangeMarker>>(); - public void add(RangeMarker rangeMarker, int oldIndent) { + public void add(@NotNull RangeMarker rangeMarker, int oldIndent) { myRangesToReindent.add(new Pair<Integer, RangeMarker>(oldIndent, rangeMarker)); } @Override - public void execute(FileViewProvider viewProvider) { + public void execute(@NotNull FileViewProvider viewProvider) { final Document document = viewProvider.getDocument(); assert document != null; final PsiFile psiFile = viewProvider.getPsi(viewProvider.getBaseLanguage()); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PlainFileManipulator.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PlainFileManipulator.java index d5646f683a7d..5c3ec6656ebd 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PlainFileManipulator.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PlainFileManipulator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.psi.PsiDocumentManager; import com.intellij.psi.PsiPlainTextFile; import com.intellij.psi.AbstractElementManipulator; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; /** * Created by IntelliJ IDEA. @@ -33,7 +34,7 @@ import com.intellij.util.IncorrectOperationException; */ public class PlainFileManipulator extends AbstractElementManipulator<PsiPlainTextFile> { @Override - public PsiPlainTextFile handleContentChange(PsiPlainTextFile file, TextRange range, String newContent) + public PsiPlainTextFile handleContentChange(@NotNull PsiPlainTextFile file, @NotNull TextRange range, String newContent) throws IncorrectOperationException { final Document document = FileDocumentManager.getInstance().getDocument(file.getVirtualFile()); document.replaceString(range.getStartOffset(), range.getEndOffset(), newContent); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java index d6b475b2c746..b81518b0d259 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/manipulators/PsiCommentManipulator.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. @@ -24,13 +24,14 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.PsiFileFactory; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.IncorrectOperationException; +import org.jetbrains.annotations.NotNull; /** * @author peter */ public class PsiCommentManipulator extends AbstractElementManipulator<PsiComment> { @Override - public PsiComment handleContentChange(PsiComment psiComment, TextRange range, String newContent) throws IncorrectOperationException { + public PsiComment handleContentChange(@NotNull PsiComment psiComment, @NotNull TextRange range, String newContent) throws IncorrectOperationException { String oldText = psiComment.getText(); String newText = oldText.substring(0, range.getStartOffset()) + newContent + oldText.substring(range.getEndOffset()); FileType type = psiComment.getContainingFile().getFileType(); @@ -40,8 +41,9 @@ public class PsiCommentManipulator extends AbstractElementManipulator<PsiComment return (PsiComment)psiComment.replace(newElement); } + @NotNull @Override - public TextRange getRangeInElement(final PsiComment element) { + public TextRange getRangeInElement(@NotNull final PsiComment element) { final String text = element.getText(); if (text.startsWith("//")) return new TextRange(2, element.getTextLength()); final int length = text.length(); diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java index ac97ea9a491c..0877a65f51bc 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubIndexImpl.java @@ -219,20 +219,22 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe } @Override - public <Key, Psi extends PsiElement> boolean process(@NotNull StubIndexKey<Key, Psi> indexKey, + public <Key, Psi extends PsiElement> boolean processElements(@NotNull StubIndexKey<Key, Psi> indexKey, @NotNull Key key, @NotNull Project project, GlobalSearchScope scope, + Class<Psi> requiredClass, @NotNull Processor<? super Psi> processor) { - return process(indexKey, key, project, scope, null, processor); + return processElements(indexKey, key, project, scope, null, requiredClass, processor); } @Override - public <Key, Psi extends PsiElement> boolean process(@NotNull final StubIndexKey<Key, Psi> indexKey, + public <Key, Psi extends PsiElement> boolean processElements(@NotNull final StubIndexKey<Key, Psi> indexKey, @NotNull final Key key, @NotNull final Project project, @Nullable final GlobalSearchScope scope, @Nullable IdFilter idFilter, + final Class<Psi> requiredClass, @NotNull final Processor<? super Psi> processor) { final FileBasedIndexImpl fileBasedIndex = (FileBasedIndexImpl)FileBasedIndex.getInstance(); fileBasedIndex.ensureUpToDate(StubUpdatingIndex.INDEX_ID, project, scope); @@ -259,7 +261,7 @@ public class StubIndexImpl extends StubIndex implements ApplicationComponent, Pe if (file == null || scope != null && !scope.contains(file)) { return true; } - return myStubProcessingHelper.processStubsInFile(project, file, value, processor); + return myStubProcessingHelper.processStubsInFile(project, file, value, processor, requiredClass); } }); diff --git a/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java b/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java index 92844c7d00b1..2e0b5c578550 100644 --- a/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java +++ b/platform/lang-impl/src/com/intellij/psi/stubs/StubProcessingHelper.java @@ -1,16 +1,14 @@ package com.intellij.psi.stubs; import com.intellij.diagnostic.LogMessageEx; -import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ModalityState; +import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiCompiledElement; import com.intellij.psi.impl.source.PsiFileWithStubSupport; import com.intellij.util.indexing.FileBasedIndex; -import java.util.List; - /** * Author: dmitrylomov */ @@ -35,11 +33,9 @@ public class StubProcessingHelper extends StubProcessingHelperBase { @Override - protected Object stubTreeAndIndexDoNotMatch(StubTree stubTree, - PsiFileWithStubSupport psiFile, - List<StubElement<?>> plained, - VirtualFile virtualFile, - StubTree stubTreeFromIndex) { + protected Object stubTreeAndIndexDoNotMatch(StubTree stubTree, PsiFileWithStubSupport psiFile) { + final VirtualFile virtualFile = psiFile.getVirtualFile(); + StubTree stubTreeFromIndex = (StubTree)StubTreeLoader.getInstance().readFromVFile(psiFile.getProject(), virtualFile); String details = "Please report the problem to JetBrains with the file attached"; details += "\npsiFile" + psiFile; details += "\npsiFile.class" + psiFile.getClass(); diff --git a/platform/lang-impl/src/com/intellij/refactoring/classMembers/MemberDependenciesStorage.java b/platform/lang-impl/src/com/intellij/refactoring/classMembers/MemberDependenciesStorage.java index d01dc0f51e9e..fb3a597fda06 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/classMembers/MemberDependenciesStorage.java +++ b/platform/lang-impl/src/com/intellij/refactoring/classMembers/MemberDependenciesStorage.java @@ -28,7 +28,7 @@ import java.util.Set; public class MemberDependenciesStorage<T extends NavigatablePsiElement, C extends PsiElement> { protected final C myClass; - private final C mySuperClass; + private C mySuperClass; private final Map<T, Set<T>> myDependencyGraph; public MemberDependenciesStorage(C aClass, C superClass) { @@ -37,6 +37,10 @@ public class MemberDependenciesStorage<T extends NavigatablePsiElement, C extend myDependencyGraph = new HashMap<T, Set<T>>(); } + public void setSuperClass(C superClass) { + mySuperClass = superClass; + } + @Nullable protected Set<T> getMemberDependencies(T member) { Set<T> result = myDependencyGraph.get(member); diff --git a/platform/lang-impl/src/com/intellij/refactoring/rename/AutomaticRenamingDialog.form b/platform/lang-impl/src/com/intellij/refactoring/rename/AutomaticRenamingDialog.form index 525be912c9b2..b17b2e48e36b 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/rename/AutomaticRenamingDialog.form +++ b/platform/lang-impl/src/com/intellij/refactoring/rename/AutomaticRenamingDialog.form @@ -3,7 +3,7 @@ <grid id="27dc6" binding="myPanel" 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> - <xy x="20" y="20" width="500" height="400"/> + <xy x="20" y="20" width="631" height="400"/> </constraints> <properties/> <border type="none"/> @@ -28,8 +28,7 @@ <border type="none"/> <children/> </grid> - <grid id="177e3" layout-manager="GridLayoutManager" row-count="2" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> - <margin top="0" left="0" bottom="0" right="0"/> + <grid id="177e3" layout-manager="GridBagLayout"> <constraints> <splitpane position="left"/> </constraints> @@ -38,7 +37,8 @@ <children> <scrollpane id="86224" class="com.intellij.ui.components.JBScrollPane"> <constraints> - <grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <grid row="0" column="0" row-span="1" col-span="6" vsize-policy="3" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/> + <gridbag weightx="1.0" weighty="1.0"/> </constraints> <properties/> <border type="none"/> @@ -49,27 +49,34 @@ </component> </children> </scrollpane> - <component id="c4746" class="javax.swing.JButton" binding="mySelectAllButton" default-binding="true"> + <grid id="6e08e" layout-manager="GridBagLayout"> <constraints> - <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/> + <grid row="1" column="0" row-span="1" col-span="6" vsize-policy="3" hsize-policy="3" anchor="4" fill="2" indent="0" use-parent-layout="false"/> + <gridbag weightx="0.0" weighty="0.0"/> </constraints> - <properties> - <text resource-bundle="messages/RefactoringBundle" key="select.all.button"/> - </properties> - </component> - <component id="1217e" class="javax.swing.JButton" binding="myUnselectAllButton" default-binding="true"> - <constraints> - <grid row="1" column="2" 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 resource-bundle="messages/RefactoringBundle" key="unselect.all.button"/> - </properties> - </component> - <hspacer id="eacfb"> - <constraints> - <grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> - </constraints> - </hspacer> + <properties/> + <border type="none"/> + <children> + <component id="1217e" class="javax.swing.JButton" binding="myUnselectAllButton" default-binding="true"> + <constraints> + <grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/> + <gridbag top="0" left="5" bottom="0" right="0" weightx="0.0" weighty="0.0"/> + </constraints> + <properties> + <text resource-bundle="messages/RefactoringBundle" key="unselect.all.button"/> + </properties> + </component> + <component id="c4746" class="javax.swing.JButton" binding="mySelectAllButton" default-binding="true"> + <constraints> + <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/> + <gridbag weightx="0.0" weighty="0.0"/> + </constraints> + <properties> + <text resource-bundle="messages/RefactoringBundle" key="select.all.button"/> + </properties> + </component> + </children> + </grid> </children> </grid> </children> diff --git a/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java b/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java index 7d8b57b1266f..865df79f2944 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java +++ b/platform/lang-impl/src/com/intellij/refactoring/ui/AbstractMemberSelectionTable.java @@ -126,6 +126,14 @@ public abstract class AbstractMemberSelectionTable<T extends PsiElement, M exten myTableModel.fireTableDataChanged(); } + /** + * Redraws table + */ + public void redraw() { + myTableModel.redraw(getSelectedMemberInfos()); + myTableModel.fireTableDataChanged(); + } + public void setMemberInfos(Collection<M> memberInfos) { myMemberInfos = new ArrayList<M>(memberInfos); fireMemberInfoChange(memberInfos); @@ -313,9 +321,13 @@ public abstract class AbstractMemberSelectionTable<T extends PsiElement, M exten } Collection<M> changed = Collections.singletonList(myTable.myMemberInfos.get(rowIndex)); + redraw(changed); +// fireTableRowsUpdated(rowIndex, rowIndex); + } + + public void redraw(Collection<M> changed) { myTable.fireMemberInfoChange(changed); fireTableDataChanged(); -// fireTableRowsUpdated(rowIndex, rowIndex); } } diff --git a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java index 803a301e856e..579d7a19405a 100644 --- a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java +++ b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.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. @@ -155,7 +155,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta myVfsListener = new VirtualFileAdapter() { @Override - public void contentsChanged(VirtualFileEvent event) { + public void contentsChanged(@NotNull VirtualFileEvent event) { final VirtualFile file = pathToFile(); if (file != null && file.equals(event.getFile())) { loadFrom(event.getFile()); 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 3be0cfaa79a9..ed0dd1b19c6b 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndexImpl.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. @@ -1766,7 +1766,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { } } - private static FileType getFileType(VirtualFile file) { + public static FileType getFileType(VirtualFile file) { FileType fileType = file.getFileType(); if (fileType == FileTypes.PLAIN_TEXT && FileTypeManagerImpl.isFileTypeDetectedFromContent(file)) { fileType = FileTypes.UNKNOWN; @@ -1774,6 +1774,10 @@ public class FileBasedIndexImpl extends FileBasedIndex { return fileType; } + public boolean isIndexingCandidate(VirtualFile file, ID<?, ?> indexId) { + return !isTooLarge(file) && getAffectedIndexCandidates(file).contains(indexId); + } + private List<ID<?, ?>> getAffectedIndexCandidates(VirtualFile file) { if (file.isDirectory()) { return isProjectOrWorkspaceFile(file, null) ? Collections.<ID<?,?>>emptyList() : myIndicesForDirectories; @@ -1920,7 +1924,7 @@ public class FileBasedIndexImpl extends FileBasedIndex { private final ManagingFS myManagingFS = ManagingFS.getInstance(); @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { markDirty(event, false); } diff --git a/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java b/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java index 2c0317a14677..f394c836475d 100644 --- a/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java +++ b/platform/lang-impl/src/com/intellij/webcore/packaging/InstalledPackagesPanel.java @@ -68,6 +68,10 @@ public class InstalledPackagesPanel extends JPanel { return tableCellRenderer; } }; + // Defence from javax.swing.JTable.initializeLocalVars: + // setPreferredScrollableViewportSize(new Dimension(450, 400)); + myPackagesTable.setPreferredScrollableViewportSize(null); + myPackagesTable.setStriped(true); myPackagesTable.getTableHeader().setReorderingAllowed(false); myUpgradeButton = new AnActionButton("Upgrade", IconUtil.getMoveUpIcon()) { @@ -94,7 +98,6 @@ public class InstalledPackagesPanel extends JPanel { }) .addExtraAction(myUpgradeButton); - decorator.setPreferredSize(new Dimension(500, 500)); add(decorator.createPanel()); myInstallButton = decorator.getActionsPanel().getAnActionButton(CommonActionsPanel.Buttons.ADD); myUninstallButton = decorator.getActionsPanel().getAnActionButton(CommonActionsPanel.Buttons.REMOVE); @@ -279,40 +282,35 @@ public class InstalledPackagesPanel extends JPanel { } private void updateUninstallUpgrade() { - ApplicationManager.getApplication().invokeLater(new Runnable() { - @Override - public void run() { - final int[] selected = myPackagesTable.getSelectedRows(); - boolean upgradeAvailable = false; - boolean canUninstall = selected.length != 0; - boolean canUpgrade = true; - if (myPackageManagementService != null && selected.length != 0) { - for (int i = 0; i != selected.length; ++i) { - final int index = selected[i]; - if (index >= myPackagesTable.getRowCount()) continue; - final Object value = myPackagesTable.getValueAt(index, 0); - if (value instanceof InstalledPackage) { - final InstalledPackage pkg = (InstalledPackage)value; - if (!canUninstallPackage(pkg)) { - canUninstall = false; - } - if (!canUpgradePackage(pkg)) { - canUpgrade = false; - } - final String pyPackageName = pkg.getName(); - final String availableVersion = (String)myPackagesTable.getValueAt(index, 2); - if (!upgradeAvailable) { - upgradeAvailable = PackageVersionComparator.VERSION_COMPARATOR.compare(pkg.getVersion(), availableVersion) < 0 && - !myCurrentlyInstalling.contains(pyPackageName); - } - if (!canUninstall && !canUpgrade) break; - } + final int[] selected = myPackagesTable.getSelectedRows(); + boolean upgradeAvailable = false; + boolean canUninstall = selected.length != 0; + boolean canUpgrade = true; + if (myPackageManagementService != null && selected.length != 0) { + for (int i = 0; i != selected.length; ++i) { + final int index = selected[i]; + if (index >= myPackagesTable.getRowCount()) continue; + final Object value = myPackagesTable.getValueAt(index, 0); + if (value instanceof InstalledPackage) { + final InstalledPackage pkg = (InstalledPackage)value; + if (!canUninstallPackage(pkg)) { + canUninstall = false; + } + if (!canUpgradePackage(pkg)) { + canUpgrade = false; + } + final String pyPackageName = pkg.getName(); + final String availableVersion = (String)myPackagesTable.getValueAt(index, 2); + if (!upgradeAvailable) { + upgradeAvailable = PackageVersionComparator.VERSION_COMPARATOR.compare(pkg.getVersion(), availableVersion) < 0 && + !myCurrentlyInstalling.contains(pyPackageName); } + if (!canUninstall && !canUpgrade) break; } - myUninstallButton.setEnabled(canUninstall); - myUpgradeButton.setEnabled(upgradeAvailable && canUpgrade); } - }, ModalityState.any()); + } + myUninstallButton.setEnabled(canUninstall); + myUpgradeButton.setEnabled(upgradeAvailable && canUpgrade); } protected boolean canUninstallPackage(InstalledPackage pyPackage) { @@ -398,6 +396,7 @@ public class InstalledPackagesPanel extends JPanel { private void onUpdateFinished() { myPackagesTable.setPaintBusy(false); myPackagesTable.getEmptyText().setText(StatusText.DEFAULT_EMPTY_TEXT); + updateUninstallUpgrade(); } public void doUpdatePackages(@NotNull final PackageManagementService packageManagementService) { @@ -469,27 +468,23 @@ public class InstalledPackagesPanel extends JPanel { private void decrement() { if (inProgressPackageCount.decrementAndGet() == 0) { - UIUtil.invokeLaterIfNeeded(new Runnable() { - @Override - public void run() { - onUpdateFinished(); - } - }); + onUpdateFinished(); } } @Override public void consume(Exception e) { - decrement(); + UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override + public void run() { + decrement(); + } + }); } @Override public void consume(@Nullable final String latestVersion) { - if (latestVersion == null) { - decrement(); - return; - } - ApplicationManager.getApplication().invokeLater(new Runnable() { + UIUtil.invokeLaterIfNeeded(new Runnable() { @Override public void run() { if (finalIndex < myPackagesTableModel.getRowCount()) { @@ -500,7 +495,7 @@ public class InstalledPackagesPanel extends JPanel { } decrement(); } - }, ModalityState.any()); + }); } }); } diff --git a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java index 55dedc6a0334..cb20957f3ed7 100644 --- a/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.java +++ b/platform/lvcs-impl/src/com/intellij/history/integration/LocalHistoryEventDispatcher.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. @@ -24,6 +24,7 @@ import com.intellij.openapi.command.CommandListener; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.*; +import org.jetbrains.annotations.NotNull; public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements VirtualFileManagerListener, CommandListener { private static final Key<Boolean> WAS_VERSIONED_KEY = @@ -81,7 +82,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V } @Override - public void fileCreated(VirtualFileEvent e) { + public void fileCreated(@NotNull VirtualFileEvent e) { beginChangeSet(); createRecursively(e.getFile()); endChangeSet(null); @@ -99,7 +100,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V } @Override - public void beforeContentsChange(VirtualFileEvent e) { + public void beforeContentsChange(@NotNull VirtualFileEvent e) { if (!areContentChangesVersioned(e)) return; VirtualFile f = e.getFile(); @@ -110,7 +111,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V } @Override - public void beforePropertyChange(VirtualFilePropertyEvent e) { + public void beforePropertyChange(@NotNull VirtualFilePropertyEvent e) { if (VirtualFile.PROP_NAME.equals(e.getPropertyName())) { VirtualFile f = e.getFile(); f.putUserData(WAS_VERSIONED_KEY, myGateway.isVersioned(f)); @@ -118,7 +119,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V } @Override - public void propertyChanged(VirtualFilePropertyEvent e) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent e) { if (VirtualFile.PROP_NAME.equals(e.getPropertyName())) { VirtualFile f = e.getFile(); @@ -142,13 +143,13 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V } @Override - public void beforeFileMovement(VirtualFileMoveEvent e) { + public void beforeFileMovement(@NotNull VirtualFileMoveEvent e) { VirtualFile f = e.getFile(); f.putUserData(WAS_VERSIONED_KEY, myGateway.isVersioned(f)); } @Override - public void fileMoved(VirtualFileMoveEvent e) { + public void fileMoved(@NotNull VirtualFileMoveEvent e) { VirtualFile f = e.getFile(); boolean isVersioned = myGateway.isVersioned(f); @@ -162,7 +163,7 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V } @Override - public void beforeFileDeletion(VirtualFileEvent e) { + public void beforeFileDeletion(@NotNull VirtualFileEvent e) { VirtualFile f = e.getFile(); Entry entry = myGateway.createEntryForDeletion(f); if (entry != null) { diff --git a/platform/lvcs-impl/src/com/intellij/openapi/command/impl/FileUndoProvider.java b/platform/lvcs-impl/src/com/intellij/openapi/command/impl/FileUndoProvider.java index d5ea0004730d..5a264254d7db 100644 --- a/platform/lvcs-impl/src/com/intellij/openapi/command/impl/FileUndoProvider.java +++ b/platform/lvcs-impl/src/com/intellij/openapi/command/impl/FileUndoProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.*; import com.intellij.util.FileContentUtil; +import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -85,18 +86,18 @@ public class FileUndoProvider extends VirtualFileAdapter implements UndoProvider } @Override - public void fileCreated(VirtualFileEvent e) { + public void fileCreated(@NotNull VirtualFileEvent e) { processEvent(e); } @Override - public void propertyChanged(VirtualFilePropertyEvent e) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent e) { if (!e.getPropertyName().equals(VirtualFile.PROP_NAME)) return; processEvent(e); } @Override - public void fileMoved(VirtualFileMoveEvent e) { + public void fileMoved(@NotNull VirtualFileMoveEvent e) { processEvent(e); } @@ -111,14 +112,14 @@ public class FileUndoProvider extends VirtualFileAdapter implements UndoProvider } @Override - public void beforeContentsChange(VirtualFileEvent e) { + public void beforeContentsChange(@NotNull VirtualFileEvent e) { if (shouldNotProcess(e)) return; if (isUndoable(e)) return; registerNonUndoableAction(e); } @Override - public void beforeFileDeletion(VirtualFileEvent e) { + public void beforeFileDeletion(@NotNull VirtualFileEvent e) { if (shouldNotProcess(e)) { invalidateActionsFor(e); return; @@ -133,7 +134,7 @@ public class FileUndoProvider extends VirtualFileAdapter implements UndoProvider } @Override - public void fileDeleted(VirtualFileEvent e) { + public void fileDeleted(@NotNull VirtualFileEvent e) { VirtualFile f = e.getFile(); DocumentReference ref = f.getUserData(DELETION_WAS_UNDOABLE); diff --git a/platform/platform-api/platform-api.iml b/platform/platform-api/platform-api.iml index df91a1972748..3a4898f7c5cd 100644 --- a/platform/platform-api/platform-api.iml +++ b/platform/platform-api/platform-api.iml @@ -35,6 +35,7 @@ <orderEntry type="library" name="pty4j" level="project" /> <orderEntry type="library" name="Guava" level="project" /> <orderEntry type="library" name="http-client" level="project" /> + <orderEntry type="module" module-name="structure-view-api" exported="" /> </component> </module> diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java index 5fccbdcf6c8d..f449ed1c2884 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java +++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.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. @@ -717,8 +717,9 @@ public class AbstractTreeUi { Runnable update = new Runnable() { @Override public void run() { - if (getElementFromDescriptor(rootDescriptor.get()) != null) { - createMapping(getElementFromDescriptor(rootDescriptor.get()), getRootNode()); + Object fromDescriptor = getElementFromDescriptor(rootDescriptor.get()); + if (fromDescriptor != null) { + createMapping(fromDescriptor, getRootNode()); } @@ -3070,8 +3071,9 @@ public class AbstractTreeUi { public void run() { if (!oldElement.equals(newElement.get()) || forceRemapping.get()) { removeMapping(oldElement, childNode, newElement.get()); - if (newElement.get() != null) { - createMapping(newElement.get(), childNode); + Object newE = newElement.get(); + if (newE != null) { + createMapping(newE, childNode); } NodeDescriptor parentDescriptor = getDescriptorFrom(parentNode); if (parentDescriptor != null) { @@ -3660,7 +3662,9 @@ public class AbstractTreeUi { NodeDescriptor descriptor = getDescriptorFrom(node); if (descriptor == null) return; final Object element = getElementFromDescriptor(descriptor); - removeMapping(element, node, null); + if (element != null) { + removeMapping(element, node, null); + } myAutoExpandRoots.remove(element); node.setUserObject(null); node.removeAllChildren(); @@ -4565,7 +4569,7 @@ public class AbstractTreeUi { myUpdaterState = null; } - private void createMapping(Object element, DefaultMutableTreeNode node) { + private void createMapping(@NotNull Object element, DefaultMutableTreeNode node) { element = TreeAnchorizer.getService().createAnchor(element); if (!myElementToNodeMap.containsKey(element)) { myElementToNodeMap.put(element, node); @@ -4585,7 +4589,7 @@ public class AbstractTreeUi { } } - private void removeMapping(Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) { + private void removeMapping(@NotNull Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) { element = TreeAnchorizer.getService().createAnchor(element); final Object value = myElementToNodeMap.get(element); if (value != null) { diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java index 6aade96ca923..2c81a6603c0c 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.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 @@ public interface DataConstants { /** * Returns {@link com.intellij.openapi.module.Module} * - * @depreacated use {@link com.intellij.openapi.actionSystem.LangDataKeys#MODULE} instead + * @deprecated use {@link com.intellij.openapi.actionSystem.LangDataKeys#MODULE} instead */ @NonNls String MODULE = "module"; @@ -166,7 +166,7 @@ public interface DataConstants { @NonNls String LANGUAGE = "Language"; /** - * Returns java.awt.Component currently in focus, DataContext should be retreived for + * Returns java.awt.Component currently in focus, DataContext should be retrieved for * * @deprecated use {@link com.intellij.openapi.actionSystem.PlatformDataKeys#CONTEXT_COMPONENT} instead */ @@ -232,7 +232,7 @@ public interface DataConstants { String DELETE_ELEMENT_PROVIDER = PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName(); /** - * Returns com.intellij.openapi.editor.Editor even if foces currently is in find bar + * Returns com.intellij.openapi.editor.Editor even if focuses currently is in find bar * * @deprecated use {@link com.intellij.openapi.actionSystem.PlatformDataKeys#EDITOR} instead */ diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java index 7f9e40550a6d..b515b84e8f3f 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.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. @@ -114,6 +114,8 @@ public interface IdeActions { @NonNls String ACTION_FIND = "Find"; @NonNls String ACTION_FIND_NEXT = "FindNext"; @NonNls String ACTION_FIND_PREVIOUS = "FindPrevious"; + @NonNls String ACTION_SELECT_NEXT_OCCURENCE = "SelectNextOccurrence"; + @NonNls String ACTION_UNSELECT_LAST_OCCURENCE = "UnselectLastOccurrence"; @NonNls String ACTION_COMPILE = "Compile"; @NonNls String ACTION_COMPILE_PROJECT = "CompileProject"; @NonNls String ACTION_MAKE_MODULE = "MakeModule"; diff --git a/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java b/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java index badabf49e5e6..ad67106c56eb 100644 --- a/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java +++ b/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.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.openapi.application; import com.intellij.openapi.wm.IdeFrame; @@ -7,17 +22,23 @@ import com.intellij.util.messages.Topic; * @author yole */ public interface ApplicationActivationListener { + Topic<ApplicationActivationListener> TOPIC = Topic.create("Application activation notifications", ApplicationActivationListener.class); + /** - * Is called when app is activated by transferring focus to it - * @param ideFrame + * Called when app is activated by transferring focus to it. */ void applicationActivated(IdeFrame ideFrame); /** - * Is called when app is de-activated by transferring focus from it - * @param ideFrame + * Called when app is de-activated by transferring focus from it. */ void applicationDeactivated(IdeFrame ideFrame); - Topic<ApplicationActivationListener> TOPIC = Topic.create("com.intellij.openapi.application.ApplicationActivationListener", ApplicationActivationListener.class); + abstract class Adapter implements ApplicationActivationListener { + @Override + public void applicationActivated(IdeFrame ideFrame) { } + + @Override + public void applicationDeactivated(IdeFrame ideFrame) { } + } } diff --git a/platform/platform-api/src/com/intellij/openapi/editor/TextLineWrapPositionStrategy.java b/platform/platform-api/src/com/intellij/openapi/editor/TextLineWrapPositionStrategy.java new file mode 100644 index 000000000000..21e232a1c038 --- /dev/null +++ b/platform/platform-api/src/com/intellij/openapi/editor/TextLineWrapPositionStrategy.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.openapi.editor; + +public class TextLineWrapPositionStrategy extends GenericLineWrapPositionStrategy { + + public TextLineWrapPositionStrategy() { + // Commas. + addRule(new Rule(',', WrapCondition.AFTER, Rule.DEFAULT_WEIGHT)); + + // Symbols to wrap either before or after. + addRule(new Rule(' ')); + addRule(new Rule('\t')); + + // Symbols to wrap after. + addRule(new Rule(';', WrapCondition.AFTER)); + addRule(new Rule(')', WrapCondition.AFTER)); + + // Symbols to wrap before + addRule(new Rule('(', WrapCondition.BEFORE)); + addRule(new Rule('.', WrapCondition.BEFORE)); + } +} diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java index 9633d2d3875b..d4b6b74eb4b2 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/EditorActionHandler.java @@ -19,6 +19,7 @@ import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.CaretAction; import com.intellij.openapi.editor.Editor; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -114,7 +115,7 @@ public abstract class EditorActionHandler { * @param editor the editor in which the action is invoked. * @param dataContext the data context for the action. */ - public void executeInCaretContext(final Editor editor, Caret caret, final DataContext dataContext) { + public void executeInCaretContext(@NotNull final Editor editor, @Nullable Caret caret, final DataContext dataContext) { if (caret == null && runForAllCarets()) { editor.getCaretModel().runForEachCaret(new CaretAction() { @Override diff --git a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java index c52ec738af4e..28bc0f0510ed 100644 --- a/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java +++ b/platform/platform-api/src/com/intellij/openapi/editor/actionSystem/TypedAction.java @@ -51,7 +51,7 @@ public class TypedAction { private static class Handler implements TypedActionHandler { @Override - public void execute(@NotNull Editor editor, char charTyped, @NotNull DataContext dataContext) { + public void execute(@NotNull final Editor editor, char charTyped, @NotNull DataContext dataContext) { if (editor.isViewer()) return; Document doc = editor.getDocument(); @@ -64,7 +64,18 @@ public class TypedAction { try { final String str = String.valueOf(charTyped); CommandProcessor.getInstance().setCurrentCommandName(EditorBundle.message("typing.in.editor.command.name")); - EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, str, true); + + if (editor.getCaretModel().getAllCarets().size() == 1) { // temporary fix for completion - going forward we shouldn't use this check + EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, str, true); + } + else { + editor.getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + EditorModificationUtil.typeInStringAtCaretHonorBlockSelection(editor, str, true); + } + }); + } } catch (ReadOnlyFragmentModificationException e) { EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e); @@ -127,22 +138,17 @@ public class TypedAction { ApplicationManager.getApplication().runWriteAction(new DocumentRunnable(myEditor.getDocument(), myEditor.getProject()) { @Override public void run() { - myEditor.getCaretModel().runForEachCaret(new CaretAction() { - @Override - public void perform(Caret caret) { - Document doc = myEditor.getDocument(); - doc.startGuardedBlockChecking(); - try { - getHandler().execute(myEditor, myCharTyped, myDataContext); - } - catch (ReadOnlyFragmentModificationException e) { - EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e); - } - finally { - doc.stopGuardedBlockChecking(); - } - } - }); + Document doc = myEditor.getDocument(); + doc.startGuardedBlockChecking(); + try { + getHandler().execute(myEditor, myCharTyped, myDataContext); + } + catch (ReadOnlyFragmentModificationException e) { + EditorActionManager.getInstance().getReadonlyFragmentModificationHandler(doc).handle(e); + } + finally { + doc.stopGuardedBlockChecking(); + } } }); } diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorBuilder.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorBuilder.java index c772b4a94308..18554769057d 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorBuilder.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorBuilder.java @@ -86,14 +86,17 @@ public class FileChooserDescriptorBuilder { myDescription = description; return this; } - - public FileChooserDescriptorBuilder showFileSystemRoots(boolean showFileSystemRoots) { - myShowFileSystemRoots = showFileSystemRoots; + + /** + * Don't show system roots in case of empty root list + */ + public FileChooserDescriptorBuilder hideSystemRoots() { + myShowFileSystemRoots = false; return this; } - public FileChooserDescriptorBuilder hideIgnored(boolean hideIgnored) { - myHideIgnored = hideIgnored; + public FileChooserDescriptorBuilder showIgnored() { + myHideIgnored = false; return this; } diff --git a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java index 057ca54e3b4b..9ad40acac277 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java +++ b/platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooserDescriptorFactory.java @@ -71,6 +71,14 @@ public class FileChooserDescriptorFactory { return new FileChooserDescriptor(true, true, false, false, false, false); } + public static FileChooserDescriptorBuilder onlyFiles() { + return FileChooserDescriptorBuilder.onlyFiles(); + } + + public static FileChooserDescriptorBuilder filesAndFolders() { + return FileChooserDescriptorBuilder.filesAndFolders(); + } + public static FileChooserDescriptor getDirectoryChooserDescriptor(String aSearchedObjectName) { final FileChooserDescriptor singleFolderDescriptor = createSingleFolderDescriptor(); singleFolderDescriptor.setTitle(UIBundle.message("file.chooser.select.object.title", aSearchedObjectName)); diff --git a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java b/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java index 4f890a63299c..d9be7105a638 100644 --- a/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.java +++ b/platform/platform-api/src/com/intellij/openapi/fileTypes/FileTypeManager.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. @@ -55,11 +55,12 @@ public abstract class FileTypeManager extends FileTypeRegistry { * @return the instance of FileTypeManager */ public static FileTypeManager getInstance() { - if (ourInstance == null) { + FileTypeManager instance = ourInstance; + if (instance == null) { Application app = ApplicationManager.getApplication(); - ourInstance = app != null ? app.getComponent(FileTypeManager.class) : new MockFileTypeManager(); + ourInstance = instance = app != null ? app.getComponent(FileTypeManager.class) : new MockFileTypeManager(); } - return ourInstance; + return instance; } /** diff --git a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java index 670cf3afd02c..7be0993de405 100644 --- a/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java +++ b/platform/platform-api/src/com/intellij/openapi/keymap/KeymapUtil.java @@ -24,6 +24,7 @@ import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.registry.RegistryValue; import com.intellij.openapi.util.registry.RegistryValueListener; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.containers.ContainerUtil; import org.intellij.lang.annotations.JdkConstants; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -58,7 +59,7 @@ public class KeymapUtil { private KeymapUtil() { } - public static String getShortcutText(Shortcut shortcut) { + public static String getShortcutText(@NotNull Shortcut shortcut) { String s = ""; if (shortcut instanceof KeyboardShortcut) { @@ -184,14 +185,18 @@ public class KeymapUtil { } } + @NotNull + public static String getFirstKeyboardShortcutText(@NotNull String actionId) { + Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(actionId); + KeyboardShortcut shortcut = ContainerUtil.findInstance(shortcuts, KeyboardShortcut.class); + return shortcut == null? "" : getShortcutText(shortcut); + } + + @NotNull public static String getFirstKeyboardShortcutText(@NotNull AnAction action) { Shortcut[] shortcuts = action.getShortcutSet().getShortcuts(); - for (Shortcut shortcut : shortcuts) { - if (shortcut instanceof KeyboardShortcut) { - return getShortcutText(shortcut); - } - } - return ""; + KeyboardShortcut shortcut = ContainerUtil.findInstance(shortcuts, KeyboardShortcut.class); + return shortcut == null ? "" : getShortcutText(shortcut); } public static String getShortcutsText(Shortcut[] shortcuts) { diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/impl/FileStatusImpl.java b/platform/platform-api/src/com/intellij/openapi/vcs/impl/FileStatusImpl.java deleted file mode 100644 index 6f1b9d1d5b59..000000000000 --- a/platform/platform-api/src/com/intellij/openapi/vcs/impl/FileStatusImpl.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.openapi.vcs.impl; - -import com.intellij.openapi.editor.colors.ColorKey; -import com.intellij.openapi.editor.colors.EditorColorsManager; -import com.intellij.openapi.vcs.FileStatus; - -import java.awt.*; - -/** - * author: lesya - */ -public class FileStatusImpl implements FileStatus { - private final String myStatus; - private final ColorKey myColorKey; - private final String myText; - - public FileStatusImpl(String status, ColorKey key, String text) { - myStatus = status; - myColorKey = key; - myText = text; - } - - public String toString() { - return myStatus; - } - - public String getText() { - return myText; - } - - public Color getColor() { - return EditorColorsManager.getInstance().getGlobalScheme().getColor(getColorKey()); - } - - public ColorKey getColorKey() { - return myColorKey; - } - - public String getId() { - return myStatus; - } - - public static class OnlyColorFileStatus extends FileStatusImpl { - public OnlyColorFileStatus(String status, ColorKey key, String text) { - super(status, key, text); - } - - @Override - public String getId() { - throw new UnsupportedOperationException(); - } - - @Override - public String getText() { - throw new UnsupportedOperationException(); - } - } -} diff --git a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java b/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java index 2ba56c2f5718..4e29be946b93 100644 --- a/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java +++ b/platform/platform-api/src/com/intellij/openapi/vfs/newvfs/VirtualFileFilteringListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,70 +36,70 @@ public class VirtualFileFilteringListener implements VirtualFileListener { } @Override - public void beforeContentsChange(final VirtualFileEvent event) { + public void beforeContentsChange(@NotNull final VirtualFileEvent event) { if (isGood(event)) { myDelegate.beforeContentsChange(event); } } @Override - public void beforeFileDeletion(final VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull final VirtualFileEvent event) { if (isGood(event)) { myDelegate.beforeFileDeletion(event); } } @Override - public void beforeFileMovement(final VirtualFileMoveEvent event) { + public void beforeFileMovement(@NotNull final VirtualFileMoveEvent event) { if (isGood(event)) { myDelegate.beforeFileMovement(event); } } @Override - public void beforePropertyChange(final VirtualFilePropertyEvent event) { + public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) { if (isGood(event)) { myDelegate.beforePropertyChange(event); } } @Override - public void contentsChanged(final VirtualFileEvent event) { + public void contentsChanged(@NotNull final VirtualFileEvent event) { if (isGood(event)) { myDelegate.contentsChanged(event); } } @Override - public void fileCopied(final VirtualFileCopyEvent event) { + public void fileCopied(@NotNull final VirtualFileCopyEvent event) { if (isGood(event)) { myDelegate.fileCopied(event); } } @Override - public void fileCreated(final VirtualFileEvent event) { + public void fileCreated(@NotNull final VirtualFileEvent event) { if (isGood(event)) { myDelegate.fileCreated(event); } } @Override - public void fileDeleted(final VirtualFileEvent event) { + public void fileDeleted(@NotNull final VirtualFileEvent event) { if (isGood(event)) { myDelegate.fileDeleted(event); } } @Override - public void fileMoved(final VirtualFileMoveEvent event) { + public void fileMoved(@NotNull final VirtualFileMoveEvent event) { if (isGood(event)) { myDelegate.fileMoved(event); } } @Override - public void propertyChanged(final VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull final VirtualFilePropertyEvent event) { if (isGood(event)) { myDelegate.propertyChanged(event); } diff --git a/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java b/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java index 7f9fbb337ddc..d8f7e86d4b9e 100644 --- a/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java +++ b/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java @@ -42,7 +42,7 @@ import java.awt.event.KeyEvent; * comp.requestFocus(); * </pre> * - * This class is also responsible for delivering key events while focus tranferring is in progress. + * This class is also responsible for delivering key events while focus transferring is in progress. * <p> * <code>IdeFocusManager</code> instance can be received per project or the global instance. The preferred way is * to use instance <code>IdeFocusManager.getInstance(project)</code>. If no project instance is available, then diff --git a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowId.java b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowId.java index b572f15f0f44..edcf3b87ae2a 100644 --- a/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowId.java +++ b/platform/platform-api/src/com/intellij/openapi/wm/ToolWindowId.java @@ -37,4 +37,5 @@ public interface ToolWindowId { String DUPLICATES = UIBundle.message("tool.window.name.module.duplicates"); String DOCUMENTATION = UIBundle.message("tool.window.name.documentation"); String TASKS = UIBundle.message("tool.window.name.tasks"); + String DATABASE_VIEW = UIBundle.message("tool.window.name.database"); }
\ No newline at end of file diff --git a/platform/platform-api/src/com/intellij/psi/statistics/StatisticsManager.java b/platform/platform-api/src/com/intellij/psi/statistics/StatisticsManager.java index 87361ef86aad..b89c74686b26 100644 --- a/platform/platform-api/src/com/intellij/psi/statistics/StatisticsManager.java +++ b/platform/platform-api/src/com/intellij/psi/statistics/StatisticsManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,9 @@ import org.jetbrains.annotations.Nullable; public abstract class StatisticsManager implements SettingsSavingComponent { public static final int OBLIVION_THRESHOLD = 7; private static final KeyedExtensionCollector<Statistician,Key> COLLECTOR = new KeyedExtensionCollector<Statistician, Key>("com.intellij.statistician") { - protected String keyToString(final Key key) { + @Override + @NotNull + protected String keyToString(@NotNull final Key key) { return key.toString(); } }; diff --git a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java index 3aab2f8df622..67f78579e660 100644 --- a/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/MouseDragHelper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 abstract class MouseDragHelper implements MouseListener, MouseMotionListe private final JComponent myDragComponent; private Point myPressPointScreen; + protected Point myPressedOnScreenPoint; private Point myPressPointComponent; private boolean myDraggingNow; @@ -114,6 +115,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe if (!canStartDragging(e)) return; myPressPointScreen = new RelativePoint(e).getScreenPoint(); + myPressedOnScreenPoint = new Point(myPressPointScreen); myPressPointComponent = e.getPoint(); processMousePressed(e); @@ -144,6 +146,7 @@ public abstract class MouseDragHelper implements MouseListener, MouseMotionListe } } finally { + myPressedOnScreenPoint = null; resetDragState(); e.consume(); if (myDetachPostponed) { diff --git a/platform/platform-api/src/com/intellij/ui/table/JBTable.java b/platform/platform-api/src/com/intellij/ui/table/JBTable.java index 421f7dcfeb02..1faa21b4ce5c 100644 --- a/platform/platform-api/src/com/intellij/ui/table/JBTable.java +++ b/platform/platform-api/src/com/intellij/ui/table/JBTable.java @@ -62,6 +62,7 @@ public class JBTable extends JTable implements ComponentWithEmptyText, Component public JBTable(final TableModel model) { super(model); + myEmptyText = new StatusText(this) { @Override protected boolean isStatusVisible() { diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java index bd8364813049..3ba5cd0b381d 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/DragHelper.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,12 +16,12 @@ package com.intellij.ui.tabs.impl; import com.intellij.ide.IdeBundle; -import com.intellij.ide.ui.UISettings; import com.intellij.openapi.ui.Messages; import com.intellij.ui.InplaceButton; import com.intellij.ui.MouseDragHelper; import com.intellij.ui.ScreenUtil; import com.intellij.ui.awt.RelativePoint; +import com.intellij.ui.tabs.JBTabsPosition; import com.intellij.ui.tabs.TabInfo; import com.intellij.ui.util.Axis; import org.jetbrains.annotations.Nullable; @@ -238,12 +238,12 @@ class DragHelper extends MouseDragHelper { endDrag(willDragOutStart); - final int place = UISettings.getInstance().EDITOR_TAB_PLACEMENT; + final JBTabsPosition position = myTabs.getTabsPosition(); - if (!willDragOutStart && JBEditorTabs.isAlphabeticalMode() && place != SwingConstants.TOP && place != SwingConstants.BOTTOM) { - final Point p = new Point(event.getPoint()); - SwingUtilities.convertPoint(event.getComponent(), p, myTabs); - if (myTabs.getVisibleRect().contains(p)) { + if (!willDragOutStart && JBEditorTabs.isAlphabeticalMode() && position != JBTabsPosition.top && position != JBTabsPosition.bottom) { + Point p = new Point(event.getPoint()); + p = SwingUtilities.convertPoint(event.getComponent(), p, myTabs); + if (myTabs.getVisibleRect().contains(p) && myPressedOnScreenPoint.distance(new RelativePoint(event).getScreenPoint()) > 15) { final int answer = Messages.showOkCancelDialog(myTabs, IdeBundle.message("alphabetical.mode.is.on.warning"), IdeBundle.message("title.warning"), diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java index 563206339b48..761d3ea0d341 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBEditorTabs.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. @@ -22,6 +22,7 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; 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.IdeFocusManager; import com.intellij.ui.tabs.JBTabsPosition; import com.intellij.ui.tabs.TabInfo; @@ -34,6 +35,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.*; +import java.util.Collections; +import java.util.Comparator; import java.util.List; /** @@ -138,7 +141,14 @@ public class JBEditorTabs extends JBTabsImpl { @Override protected void doPaintBackground(Graphics2D g2d, Rectangle clip) { List<TabInfo> visibleInfos = getVisibleInfos(); - + if (isAlphabeticalMode()) { + Collections.sort(visibleInfos, new Comparator<TabInfo>() { + @Override + public int compare(TabInfo o1, TabInfo o2) { + return StringUtil.naturalCompare(o1.getText(), o2.getText()); + } + }); + } final boolean vertical = getTabsPosition() == JBTabsPosition.left || getTabsPosition() == JBTabsPosition.right; Insets insets = getTabsBorder().getEffectiveBorder(); diff --git a/platform/platform-api/src/com/intellij/util/Alarm.java b/platform/platform-api/src/com/intellij/util/Alarm.java index 1462df1888e4..269b81b630c3 100644 --- a/platform/platform-api/src/com/intellij/util/Alarm.java +++ b/platform/platform-api/src/com/intellij/util/Alarm.java @@ -116,16 +116,12 @@ public class Alarm implements Disposable { if (runWithActiveFrameOnly && !ApplicationManager.getApplication().isActive()) { final MessageBus bus = ApplicationManager.getApplication().getMessageBus(); final MessageBusConnection connection = bus.connect(this); - connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() { + connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() { @Override public void applicationActivated(IdeFrame ideFrame) { connection.disconnect(); addRequest(request, delay); } - - @Override - public void applicationDeactivated(IdeFrame ideFrame) { - } }); } else { addRequest(request, delay); diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/CertificatesManager.java b/platform/platform-api/src/com/intellij/util/net/ssl/CertificatesManager.java index bc1f52629de6..ff02df7e49fe 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/CertificatesManager.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/CertificatesManager.java @@ -197,7 +197,7 @@ public class CertificatesManager implements ApplicationComponent, PersistentStat Application app = ApplicationManager.getApplication(); final CountDownLatch proceeded = new CountDownLatch(1); final AtomicBoolean accepted = new AtomicBoolean(); - app.invokeLater(new Runnable() { + Runnable showDialog = new Runnable() { @Override public void run() { try { @@ -211,7 +211,13 @@ public class CertificatesManager implements ApplicationComponent, PersistentStat proceeded.countDown(); } } - }, ModalityState.any()); + }; + if (app.isDispatchThread()) { + showDialog.run(); + } + else { + app.invokeLater(showDialog, ModalityState.any()); + } try { proceeded.await(); } diff --git a/platform/platform-api/src/com/intellij/util/net/ssl/ConfirmingTrustManager.java b/platform/platform-api/src/com/intellij/util/net/ssl/ConfirmingTrustManager.java index 82dd36e7f41e..bb80da46e476 100644 --- a/platform/platform-api/src/com/intellij/util/net/ssl/ConfirmingTrustManager.java +++ b/platform/platform-api/src/com/intellij/util/net/ssl/ConfirmingTrustManager.java @@ -350,6 +350,34 @@ public class ConfirmingTrustManager extends ClientOnlyTrustManager { } } + /** + * Check that underlying trust store contains certificate with specified alias. + * + * @param alias - certificate's alias to be checked + * @return - whether certificate is in storage + */ + public boolean containsCertificate(@NotNull String alias) { + myReadLock.lock(); + try { + return myKeyStore.containsAlias(alias); + } + catch (KeyStoreException e) { + LOG.error(e); + return false; + } finally { + myReadLock.unlock(); + } + } + + boolean removeAllCertificates() { + for (X509Certificate certificate : getCertificates()) { + if (!removeCertificate(certificate)) { + return false; + } + } + return true; + } + @Override public void checkServerTrusted(X509Certificate[] certificates, String s) throws CertificateException { myReadLock.lock(); diff --git a/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java b/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java index d0cfc9f0159e..d840f992b561 100644 --- a/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java +++ b/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ public interface Activatable { void hideNotify(); class Adapter implements Activatable { + @Override public void hideNotify() { } + @Override public void showNotify() { } } diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java index d8e4246c47ac..caecb4c31d7d 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/HintManagerImpl.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. @@ -587,6 +587,7 @@ public class HintManagerImpl extends HintManager implements Disposable { @NotNull LogicalPosition pos2, @PositionFlags short constraint, boolean showByBalloon) { + if (ApplicationManager.getApplication().isUnitTestMode()) return new Point(); Point p = _getHintPosition(hint, editor, pos1, pos2, constraint, showByBalloon); JLayeredPane layeredPane = editor.getComponent().getRootPane().getLayeredPane(); Dimension hintSize = hint.getComponent().getPreferredSize(); diff --git a/platform/platform-impl/src/com/intellij/execution/impl/ConsoleViewUtil.java b/platform/platform-impl/src/com/intellij/execution/impl/ConsoleViewUtil.java index f20a7340edd1..b8f27b43a488 100644 --- a/platform/platform-impl/src/com/intellij/execution/impl/ConsoleViewUtil.java +++ b/platform/platform-impl/src/com/intellij/execution/impl/ConsoleViewUtil.java @@ -40,8 +40,10 @@ import com.intellij.util.containers.FactoryMap; import org.jetbrains.annotations.NotNull; import java.awt.*; -import java.util.*; +import java.util.Arrays; +import java.util.Collections; import java.util.List; +import java.util.Map; import static com.intellij.execution.ui.ConsoleViewContentType.registerNewConsoleViewType; @@ -60,8 +62,9 @@ public class ConsoleViewUtil { return editor; } - public static void setupConsoleEditor(final EditorEx editor, final boolean foldingOutlineShown, final boolean lineMarkerAreaShown) { + public static void setupConsoleEditor(@NotNull final EditorEx editor, final boolean foldingOutlineShown, final boolean lineMarkerAreaShown) { ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { editor.setSoftWrapAppliancePlace(SoftWrapAppliancePlaces.CONSOLE); @@ -73,6 +76,7 @@ public class ConsoleViewUtil { editorSettings.setAdditionalPageAtBottom(false); editorSettings.setAdditionalColumnsCount(0); editorSettings.setAdditionalLinesCount(0); + editorSettings.setRightMarginShown(false); editor.putUserData(EDITOR_IS_CONSOLE_VIEW, true); @@ -82,12 +86,12 @@ public class ConsoleViewUtil { } editor.setColorsScheme(scheme); scheme.setColor(EditorColors.CARET_ROW_COLOR, null); - scheme.setColor(EditorColors.RIGHT_MARGIN_COLOR, null); } }); } - public static DelegateColorScheme updateConsoleColorScheme(EditorColorsScheme scheme) { + @NotNull + public static DelegateColorScheme updateConsoleColorScheme(@NotNull EditorColorsScheme scheme) { return new DelegateColorScheme(scheme) { @NotNull @Override @@ -129,12 +133,13 @@ public class ConsoleViewUtil { }; } - public static boolean isConsoleViewEditor(Editor editor) { + public static boolean isConsoleViewEditor(@NotNull Editor editor) { return editor.getUserData(EDITOR_IS_CONSOLE_VIEW) == Boolean.TRUE; } // @noinspection MismatchedQueryAndUpdateOfCollection private static final Map<List<TextAttributesKey>, Key> ourContentTypes = Collections.synchronizedMap(new FactoryMap<List<TextAttributesKey>, Key>() { + @Override protected Key create(List<TextAttributesKey> keys) { EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); TextAttributes result = scheme.getAttributes(HighlighterColors.TEXT); 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 1973cb3d8075..a3492b78d7fa 100644 --- a/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java +++ b/platform/platform-impl/src/com/intellij/execution/impl/EditorHyperlinkSupport.java @@ -38,7 +38,6 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.pom.NavigatableAdapter; import com.intellij.ui.awt.RelativePoint; -import com.intellij.util.BeforeAfter; import com.intellij.util.Consumer; import com.intellij.util.SmartList; import com.intellij.util.ui.UIUtil; @@ -66,13 +65,14 @@ public class EditorHyperlinkSupport { }; private final Editor myEditor; + @NotNull private final Project myProject; private final SortedMap<RangeHighlighter, HyperlinkInfo> myHighlighterToMessageInfoMap = new TreeMap<RangeHighlighter, HyperlinkInfo>(START_OFFSET_COMPARATOR); private int myLastIndex = NO_INDEX; - private final Consumer<BeforeAfter<Filter.Result>> myRefresher; private final List<RangeHighlighter> myHighlighters; public EditorHyperlinkSupport(@NotNull final Editor editor, @NotNull final Project project) { myEditor = editor; + myProject = project; myHighlighters = new SmartList<RangeHighlighter>(); editor.addEditorMouseListener(new EditorMouseAdapter() { @@ -80,23 +80,9 @@ public class EditorHyperlinkSupport { public void mouseClicked(EditorMouseEvent e) { final MouseEvent mouseEvent = e.getMouseEvent(); if (mouseEvent.getButton() == MouseEvent.BUTTON1 && !mouseEvent.isPopupTrigger()) { - LogicalPosition logical = myEditor.xyToLogicalPosition(e.getMouseEvent().getPoint()); - if (EditorUtil.inVirtualSpace(editor, logical)) { - return; - } - - RangeHighlighter range = findLinkRangeAt(myEditor.logicalPositionToOffset(logical)); - if (range != null) { - final HyperlinkInfo info = myHighlighterToMessageInfoMap.get(range); - if (info != null) { - if (info instanceof HyperlinkInfoBase) { - ((HyperlinkInfoBase)info).navigate(project, new RelativePoint(mouseEvent)); - } - else { - info.navigate(project); - } - linkFollowed(editor, getHyperlinks().keySet(), range); - } + Runnable runnable = getLinkNavigationRunnable(myEditor.xyToLogicalPosition(e.getMouseEvent().getPoint())); + if (runnable != null) { + runnable.run(); } } } @@ -117,38 +103,36 @@ public class EditorHyperlinkSupport { } } ); + } - myRefresher = new Consumer<BeforeAfter<Filter.Result>>() { - @Override - public void consume(BeforeAfter<Filter.Result> resultBeforeAfter) { - if (resultBeforeAfter.getBefore() == null) return; - final RangeHighlighter hyperlinkRange = findHyperlinkRange(resultBeforeAfter.getBefore().hyperlinkInfo); - if (hyperlinkRange != null) { - myHighlighterToMessageInfoMap.remove(hyperlinkRange); - } else { - final Iterator<RangeHighlighter> iterator = myHighlighters.iterator(); - while (iterator.hasNext()) { - final RangeHighlighter highlighter = iterator.next(); - if (highlighter.isValid() && containsOffset(resultBeforeAfter.getBefore().highlightStartOffset, highlighter)) { - iterator.remove(); - break; - } - } - } + @Nullable + public Runnable getLinkNavigationRunnable(final LogicalPosition logical) { + if (EditorUtil.inVirtualSpace(myEditor, logical)) { + return null; + } - if (resultBeforeAfter.getAfter() != null) { - if (resultBeforeAfter.getAfter().hyperlinkInfo != null) { - addHyperlink(resultBeforeAfter.getAfter().highlightStartOffset, resultBeforeAfter.getAfter().highlightEndOffset, - resultBeforeAfter.getAfter().highlightAttributes, resultBeforeAfter.getAfter().hyperlinkInfo); - } else if (resultBeforeAfter.getAfter().highlightAttributes != null) { - addHighlighter(resultBeforeAfter.getAfter().highlightStartOffset, resultBeforeAfter.getAfter().highlightEndOffset, - resultBeforeAfter.getAfter().highlightAttributes); + final RangeHighlighter range = findLinkRangeAt(this.myEditor.logicalPositionToOffset(logical)); + if (range != null) { + final HyperlinkInfo info = myHighlighterToMessageInfoMap.get(range); + if (info != null) { + return new Runnable() { + @Override + public void run() { + if (info instanceof HyperlinkInfoBase) { + RelativePoint point = new RelativePoint(myEditor.getContentComponent(), myEditor.logicalPositionToXY(logical)); + ((HyperlinkInfoBase)info).navigate(myProject, point); + } + else { + info.navigate(myProject); + } + linkFollowed(myEditor, getHyperlinks().keySet(), range); } - } + }; } - }; + } + return null; } - + public void adjustHighlighters(final List<FilterMixin.AdditionalHighlight> highlights) { for (FilterMixin.AdditionalHighlight highlight : highlights) { RangeHighlighter found = null; @@ -371,16 +355,8 @@ public class EditorHyperlinkSupport { range.putUserData(OLD_HYPERLINK_TEXT_ATTRIBUTES, null); } if (range == link) { - TextAttributes oldAttributes = range.getTextAttributes(); - range.putUserData(OLD_HYPERLINK_TEXT_ATTRIBUTES, oldAttributes); - TextAttributes attributes = getFollowedHyperlinkAttributes().clone(); - assert oldAttributes != null; - attributes.setFontType(oldAttributes.getFontType()); - attributes.setEffectType(oldAttributes.getEffectType()); - attributes.setEffectColor(oldAttributes.getEffectColor()); - attributes.setForegroundColor(oldAttributes.getForegroundColor()); - attributes.setBackgroundColor(oldAttributes.getBackgroundColor()); - markupModel.setRangeHighlighterAttributes(range, attributes); + range.putUserData(OLD_HYPERLINK_TEXT_ATTRIBUTES, range.getTextAttributes()); + markupModel.setRangeHighlighterAttributes(range, getFollowedHyperlinkAttributes()); } } //refresh highlighter text attributes diff --git a/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java b/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java index d4bd50adf117..dea9dd8457bf 100644 --- a/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java +++ b/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java @@ -58,17 +58,17 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn } @Override - public void addContentChangedListener(ContentChangedListener listener) { + public void addContentChangedListener(@NotNull ContentChangedListener listener) { myDispatcher.addListener(listener); } @Override - public void addContentChangedListener(final ContentChangedListener listener, Disposable parentDisposable) { + public void addContentChangedListener(@NotNull final ContentChangedListener listener, @NotNull Disposable parentDisposable) { myDispatcher.addListener(listener, parentDisposable); } @Override - public void removeContentChangedListener(ContentChangedListener listener) { + public void removeContentChangedListener(@NotNull ContentChangedListener listener) { myDispatcher.removeListener(listener); } @@ -256,6 +256,7 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn return null; } + @NotNull @Override public Transferable[] getAllContents() { String clipString = getContents(DataFlavor.stringFlavor); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java b/platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java index 544c4899ca41..015afd344dd9 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/AboutDialog.java @@ -106,6 +106,7 @@ public class AboutDialog extends JDialog { } public void windowLostFocus(WindowEvent e) { + if (e.getOppositeWindow() == null) return; long eventTime = System.currentTimeMillis(); if (eventTime - showTime.get() > delta && e.getOppositeWindow() != e.getWindow()) { dispose(); @@ -254,6 +255,9 @@ public class AboutDialog extends JDialog { UIUtil.applyRenderingHints(g); Font labelFont = UIUtil.getLabelFont(); + if (SystemInfo.isWindows) { + labelFont = new Font("Tahoma", Font.PLAIN, 12); + } for (int labelSize = 10; labelSize != 6; labelSize -= 1) { myLinks.clear(); g2.setPaint(col); diff --git a/platform/platform-impl/src/com/intellij/ide/actions/MoveTabDownAction.java b/platform/platform-impl/src/com/intellij/ide/actions/MoveTabDownAction.java new file mode 100644 index 000000000000..77aa887ef551 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/actions/MoveTabDownAction.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.ide.actions; + +import javax.swing.*; + +/** + * @author Konstantin Bulenkov + */ +public class MoveTabDownAction extends SplitAction { + protected MoveTabDownAction() { + super(SwingConstants.HORIZONTAL, true); + } +} diff --git a/platform/platform-impl/src/com/intellij/ide/actions/MoveTabRightAction.java b/platform/platform-impl/src/com/intellij/ide/actions/MoveTabRightAction.java new file mode 100644 index 000000000000..82f7572a0367 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/ide/actions/MoveTabRightAction.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.ide.actions; + +import javax.swing.*; + +/** + * @author Konstantin Bulenkov + */ +public class MoveTabRightAction extends SplitAction { + protected MoveTabRightAction() { + super(SwingConstants.VERTICAL, true); + } +} diff --git a/platform/platform-impl/src/com/intellij/ide/actions/SplitAction.java b/platform/platform-impl/src/com/intellij/ide/actions/SplitAction.java index 1e4c10d6feba..fb55f3649484 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/SplitAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/SplitAction.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. @@ -15,44 +15,52 @@ */ package com.intellij.ide.actions; -import com.intellij.ide.IdeBundle; -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.fileEditor.ex.FileEditorManagerEx; import com.intellij.openapi.fileEditor.impl.EditorWindow; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; - -import javax.swing.*; +import com.intellij.openapi.vfs.VirtualFile; /** * @author Vladimir Kondratyev + * @author Konstantin Bulenkov */ public abstract class SplitAction extends AnAction implements DumbAware { private final int myOrientation; + private final boolean myCloseSource; + + protected SplitAction(final int orientation) { + this(orientation, false); + } - protected SplitAction(final int orientation){ + protected SplitAction(final int orientation, boolean closeSource) { myOrientation = orientation; + myCloseSource = closeSource; } public void actionPerformed(final AnActionEvent event) { - final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); + final Project project = event.getData(CommonDataKeys.PROJECT); final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project); - final EditorWindow window = EditorWindow.DATA_KEY.getData(event.getDataContext()); + final EditorWindow window = event.getData(EditorWindow.DATA_KEY); + final VirtualFile file = event.getData(CommonDataKeys.VIRTUAL_FILE); fileEditorManager.createSplitter(myOrientation, window); + + if (myCloseSource && window != null && file != null) { + window.closeFile(file, false, false); + } } public void update(final AnActionEvent event) { - final Project project = CommonDataKeys.PROJECT.getData(event.getDataContext()); - final Presentation presentation = event.getPresentation(); - presentation.setText (myOrientation == SwingConstants.VERTICAL - ? IdeBundle.message("action.split.vertically") - : IdeBundle.message("action.split.horizontally")); - if (project == null) { - presentation.setEnabled(false); - return; - } - final FileEditorManagerEx fileEditorManager = FileEditorManagerEx.getInstanceEx(project); - presentation.setEnabled(fileEditorManager.hasOpenedFile ()); + final Project project = event.getData(CommonDataKeys.PROJECT); + final EditorWindow window = event.getData(EditorWindow.DATA_KEY); + final int minimum = myCloseSource ? 2 : 1; + final boolean enabled = project != null + && window != null + && window.getTabCount() >= minimum; + event.getPresentation().setEnabled(enabled); } } diff --git a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java index 08a5a5303ace..24f7cc3043e4 100644 --- a/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/errorTreeView/NewErrorTreeViewPanel.java @@ -42,6 +42,7 @@ import com.intellij.util.EditSourceOnDoubleClickHandler; import com.intellij.util.Function; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.MutableErrorTreeView; +import com.intellij.util.ui.StatusText; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; import org.jetbrains.annotations.NotNull; @@ -208,6 +209,10 @@ public class NewErrorTreeViewPanel extends JPanel implements DataProvider, Occur public boolean isCopyVisible(@NotNull DataContext dataContext) { return true; } + + @NotNull public StatusText getEmptyText() { + return myTree.getEmptyText(); + } @Override public Object getData(String dataId) { diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginColumnInfo.java b/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginColumnInfo.java index c9427cf50379..84ec678f304c 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginColumnInfo.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginColumnInfo.java @@ -28,6 +28,6 @@ class AvailablePluginColumnInfo extends PluginManagerColumnInfo { @Override public TableCellRenderer getRenderer(final IdeaPluginDescriptor pluginDescriptor) { - return new PluginsTableRenderer(pluginDescriptor); + return new PluginsTableRenderer(pluginDescriptor, true); } } diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsManagerMain.java index fb58c61b2612..9b62c16fde60 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/AvailablePluginsManagerMain.java @@ -173,13 +173,16 @@ public class AvailablePluginsManagerMain extends PluginManagerMain { protected ActionGroup getActionGroup(boolean inToolbar) { DefaultActionGroup actionGroup = new DefaultActionGroup(); actionGroup.add(new RefreshAction()); - actionGroup.add(Separator.getInstance()); - actionGroup.add(new ActionInstallPlugin(getAvailable(), getInstalled())); + if (inToolbar) { - actionGroup.add(new SortByStatusAction("Sort Installed First")); actionGroup.add(new MyFilterRepositoryAction()); actionGroup.add(new MyFilterCategoryAction()); } + else { + actionGroup.add(new SortByStatusAction("Sort Installed First")); + actionGroup.add(Separator.getInstance()); + actionGroup.add(new ActionInstallPlugin(getAvailable(), getInstalled())); + } return actionGroup; } diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java index a55cfa752988..dfd9aa07f381 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsManagerMain.java @@ -250,11 +250,11 @@ public class InstalledPluginsManagerMain extends PluginManagerMain { actionGroup.add(new MyFilterEnabledAction()); //actionGroup.add(new MyFilterBundleAction()); } else { - - actionGroup.add(new RefreshAction()); - actionGroup.add(Separator.getInstance()); - actionGroup.add(new ActionInstallPlugin(getAvailable(), getInstalled())); - actionGroup.add(new UninstallPluginAction(this, pluginTable)); + actionGroup.add(new RefreshAction()); + actionGroup.addAction(new SortByStatusAction("Sort by Status")); + actionGroup.add(Separator.getInstance()); + actionGroup.add(new ActionInstallPlugin(getAvailable(), getInstalled())); + actionGroup.add(new UninstallPluginAction(this, pluginTable)); } return actionGroup; } 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 73256852b19c..7fd2f88b716d 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/InstalledPluginsTableModel.java @@ -642,7 +642,7 @@ public class InstalledPluginsTableModel extends PluginTableModel { @Override public TableCellRenderer getRenderer(final IdeaPluginDescriptor pluginDescriptor) { - return new PluginsTableRenderer(pluginDescriptor); + return new PluginsTableRenderer(pluginDescriptor, false); } @Override diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java index 0c27f99e7c58..e6664c0845e6 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginHeaderPanel.java @@ -115,7 +115,13 @@ public class PluginHeaderPanel { myVersion.setText("Version: " + (version == null ? "N/A" : version)); myUpdated.setVisible(false); if (!plugin.isBundled()) { - myActionId = ((IdeaPluginDescriptorImpl)plugin).isDeleted() ? ACTION_ID.RESTART : ACTION_ID.UNINSTALL; + if (((IdeaPluginDescriptorImpl)plugin).isDeleted()) { + myActionId = ACTION_ID.RESTART; + } else if (InstalledPluginsTableModel.hasNewerVersion(plugin.getPluginId())) { + myActionId = ACTION_ID.UPDATE; + } else { + myActionId = ACTION_ID.UNINSTALL; + } } if (myActionId == ACTION_ID.RESTART && myManager != null && !myManager.isRequireShutdown()) { myActionId = null; @@ -167,7 +173,7 @@ public class PluginHeaderPanel { private Color getButtonForeground() { switch (myActionId) { - case UPDATE: return new JBColor(Gray._0, Gray._20); + case UPDATE: return new JBColor(Gray._0, Gray._210); case INSTALL: return new JBColor(Gray._255, Gray._210); case UNINSTALL: return new JBColor(Gray._0, Gray._140); case RESTART: @@ -179,7 +185,7 @@ public class PluginHeaderPanel { private Paint getBackgroundPaint() { switch (myActionId) { - case UPDATE: return new JBColor(new Color(209, 190, 114), new Color(132, 116, 66)); + case UPDATE: return new JBColor(new Color(209, 190, 114), new Color(49, 98, 49)); case INSTALL: return new JBColor(new Color(0x4DA864), new Color(49, 98, 49)); case UNINSTALL: return UIUtil.isUnderDarcula() ? new GradientPaint(0, 0, UIManager.getColor("Button.darcula.color1"), @@ -216,7 +222,7 @@ public class PluginHeaderPanel { @Override public Icon getIcon() { switch (myActionId) { - case UPDATE: return AllIcons.Actions.Refresh; + case UPDATE: return AllIcons.General.DownloadPlugin; case INSTALL: return AllIcons.General.DownloadPlugin; case UNINSTALL: return AllIcons.Actions.Delete; case RESTART: return AllIcons.Actions.Restart; @@ -230,7 +236,6 @@ public class PluginHeaderPanel { public void actionPerformed(ActionEvent e) { switch (myActionId) { case UPDATE: - break; case INSTALL: new ActionInstallPlugin(myManager.getAvailable(), myManager.getInstalled()).install(new Runnable() { @Override diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form index 597fc45c26a3..c68e09d8e7c6 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.form @@ -29,14 +29,14 @@ </component> </children> </grid> - <grid id="cebe0" layout-manager="BorderLayout" hgap="0" vgap="0"> + <grid id="cebe0" binding="myInfoPanel" layout-manager="BorderLayout" hgap="0" vgap="0"> <constraints border-constraint="Center"/> <properties> <opaque value="false"/> </properties> <border type="none"/> <children> - <grid id="80605" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> + <grid id="80605" binding="myBottomPanel" 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 border-constraint="South"/> <properties> diff --git a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java index b20d9a6e241b..174ca5a3f372 100644 --- a/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java +++ b/platform/platform-impl/src/com/intellij/ide/plugins/PluginsTableRenderer.java @@ -43,12 +43,20 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer { private JLabel myCategory; private JPanel myRightPanel; + private JPanel myBottomPanel; + private JPanel myInfoPanel; private final IdeaPluginDescriptor myPluginDescriptor; - public PluginsTableRenderer(IdeaPluginDescriptor pluginDescriptor) { + public PluginsTableRenderer(IdeaPluginDescriptor pluginDescriptor, boolean showFullInfo) { myPluginDescriptor = pluginDescriptor; + boolean myShowFullInfo = showFullInfo; - final Font smallFont = UIUtil.getLabelFont(SystemInfo.isMac ? UIUtil.FontSize.MINI : UIUtil.FontSize.SMALL); + final Font smallFont; + if (SystemInfo.isMac) { + smallFont = UIUtil.getLabelFont(UIUtil.FontSize.MINI); + } else { + smallFont = UIUtil.getLabelFont().deriveFont(Math.max(UIUtil.getLabelFont().getSize() - 2, 11f)); + } myName.setFont(UIUtil.getLabelFont().deriveFont(UIUtil.getLabelFont().getSize() + 1.0f)); myStatus.setFont(smallFont); myCategory.setFont(smallFont); @@ -56,9 +64,14 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer { myStatus.setText(""); myCategory.setText(""); myLastUpdated.setFont(smallFont); - if (! (pluginDescriptor instanceof PluginNode)) { + if (!myShowFullInfo || !(pluginDescriptor instanceof PluginNode)) { myPanel.remove(myRightPanel); } + + if (!myShowFullInfo) { + myInfoPanel.remove(myBottomPanel); + } + myPanel.setBorder(UIUtil.isRetina() ? new EmptyBorder(4,3,4,3) : new EmptyBorder(2,3,2,3)); } @@ -69,7 +82,7 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer { final Color fg = UIUtil.getTableForeground(isSelected); final Color bg = UIUtil.getTableBackground(isSelected); - final Color grayedFg = isSelected ? fg : new JBColor(Gray._130, Gray._200); + final Color grayedFg = isSelected ? fg : new JBColor(Gray._130, Gray._120); myName.setForeground(fg); myStatus.setForeground(grayedFg); myStatus.setIcon(AllIcons.Nodes.Plugin); @@ -118,7 +131,7 @@ public class PluginsTableRenderer extends DefaultTableCellRenderer { if (!isSelected) { myName.setForeground(JBColor.RED); } - myName.setIcon(AllIcons.Nodes.Pluginobsolete); + myStatus.setIcon(AllIcons.Nodes.Pluginobsolete); } //todo[kb] set proper icon //myStatus.setText("v." + pluginNode.getInstalledVersion() + (hasNewerVersion ? (" -> " + pluginNode.getVersion()) : "")); diff --git a/platform/platform-impl/src/com/intellij/ide/util/TipAndTrickBean.java b/platform/platform-impl/src/com/intellij/ide/util/TipAndTrickBean.java index fcaa09c22ae0..7aae8bef9c51 100644 --- a/platform/platform-impl/src/com/intellij/ide/util/TipAndTrickBean.java +++ b/platform/platform-impl/src/com/intellij/ide/util/TipAndTrickBean.java @@ -29,27 +29,27 @@ public class TipAndTrickBean extends AbstractExtensionPointBean { public static final ExtensionPointName<TipAndTrickBean> EP_NAME = ExtensionPointName.create("com.intellij.tipAndTrick"); @Attribute("file") - public String myFileName; + public String fileName; @Attribute("feature-id") - public String myFeatureId; - - public String getFileName() { - return myFileName; - } - - public String getFeatureId() { - return myFeatureId; - } + public String featureId; @Nullable public static TipAndTrickBean findByFileName(String tipFileName) { for (TipAndTrickBean tip : Extensions.getExtensions(EP_NAME)) { - if (Comparing.equal(tipFileName, tip.getFileName())) { + if (Comparing.equal(tipFileName, tip.fileName)) { return tip; } } return null; } + + @Override + public String toString() { + return "TipAndTrickBean{" + + "fileName='" + fileName + '\'' + + ", plugin='" + getPluginDescriptor().getPluginId() + '\'' + + '}'; + } } diff --git a/platform/platform-impl/src/com/intellij/ide/util/TipUIUtil.java b/platform/platform-impl/src/com/intellij/ide/util/TipUIUtil.java index 0fb2bbef99e0..0dbb0c9b2a93 100644 --- a/platform/platform-impl/src/com/intellij/ide/util/TipUIUtil.java +++ b/platform/platform-impl/src/com/intellij/ide/util/TipUIUtil.java @@ -64,7 +64,7 @@ public class TipUIUtil { TipAndTrickBean tip = TipAndTrickBean.findByFileName(tipFileName); if (tip == null && StringUtil.isNotEmpty(tipFileName)) { tip = new TipAndTrickBean(); - tip.myFileName = tipFileName; + tip.fileName = tipFileName; } openTipInBrowser(tip, browser); } @@ -82,7 +82,7 @@ public class TipUIUtil { ClassLoader tipLoader = pluginDescriptor == null ? TipUIUtil.class.getClassLoader() : ObjectUtils.notNull(pluginDescriptor.getPluginClassLoader(), TipUIUtil.class.getClassLoader()); - URL url = ResourceUtil.getResource(tipLoader, "/tips/", tip.getFileName()); + URL url = ResourceUtil.getResource(tipLoader, "/tips/", tip.fileName); if (url == null) { setCantReadText(browser, tip); @@ -105,10 +105,15 @@ public class TipUIUtil { } } - private static void setCantReadText(JEditorPane browser, TipAndTrickBean missingFile) { + private static void setCantReadText(JEditorPane browser, TipAndTrickBean bean) { try { - browser.read(new StringReader( - IdeBundle.message("error.unable.to.read.tip.of.the.day", missingFile, ApplicationNamesInfo.getInstance().getFullProductName())), null); + String plugin = getPoweredByText(bean); + String product = ApplicationNamesInfo.getInstance().getFullProductName(); + if (!plugin.isEmpty()) { + product += " and " + plugin + " plugin"; + } + String message = IdeBundle.message("error.unable.to.read.tip.of.the.day", bean.fileName, product); + browser.read(new StringReader(message), null); } catch (IOException ignored) { } diff --git a/platform/platform-impl/src/com/intellij/internal/statistic/JdkInfoUsageCollector.java b/platform/platform-impl/src/com/intellij/internal/statistic/JdkInfoUsageCollector.java new file mode 100644 index 000000000000..5bd268bee864 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/internal/statistic/JdkInfoUsageCollector.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.internal.statistic; + +import com.intellij.internal.statistic.beans.GroupDescriptor; +import com.intellij.internal.statistic.beans.UsageDescriptor; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.SystemInfo; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.Set; + +/** + * @author Konstantin Bulenkov + */ +public class JdkInfoUsageCollector extends UsagesCollector { + @NotNull + @Override + public Set<UsageDescriptor> getUsages(@Nullable Project project) throws CollectUsagesException { + final String vendor = System.getProperty("java.vendor", "Unknown"); + for (String version : new String[]{"1.9", "1.8", "1.7", "1.6"}) { + if (SystemInfo.isJavaVersionAtLeast(version)) { + return Collections.singleton(new UsageDescriptor(vendor + " " + version, 1)); + } + } + return Collections.emptySet(); + } + + @NotNull + @Override + public GroupDescriptor getGroupId() { + return GroupDescriptor.create("user.jdk"); + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java index ff2a354ebb27..e6a79dd487b3 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionManagerImpl.java @@ -691,7 +691,9 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat assertActionIsGroupOrStub(action); } - String actionName = action instanceof ActionStub ? ((ActionStub)action).getClassName() : action.getClass().getName(); + String actionName = String.format( + "%s (%s)", action instanceof ActionStub? ((ActionStub)action).getClassName() : action.getClass().getName(), + action instanceof ActionStub ? ((ActionStub)action).getId() : myAction2Id.get(action)); if (!ADD_TO_GROUP_ELEMENT_NAME.equals(element.getName())) { reportActionError(pluginId, "unexpected name of element \"" + element.getName() + "\""); diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItem.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItem.java index f57fc4076911..4a4322a06420 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItem.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ActionMenuItem.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. @@ -292,6 +292,9 @@ public class ActionMenuItem extends JCheckBoxMenuItem { else { if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) { Icon icon = myPresentation.getIcon(); + if (action instanceof ToggleAction && ((ToggleAction)action).isSelected(myEvent)) { + icon = new PoppedIcon(icon, 16, 16); + } setIcon(icon); if (myPresentation.getDisabledIcon() != null) { setDisabledIcon(myPresentation.getDisabledIcon()); diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/IdeaActionButtonLook.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/IdeaActionButtonLook.java index de261f29a031..fc5450da6373 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/IdeaActionButtonLook.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/IdeaActionButtonLook.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,68 +28,73 @@ import java.awt.*; /** * @author max + * @author Konstantin Bulenkov */ +@SuppressWarnings("UseJBColor") public class IdeaActionButtonLook extends ActionButtonLook { - private static final Color ALPHA_20 = new Color(0, 0, 0, 20); - private static final Color ALPHA_30 = new Color(0, 0, 0, 30); - private static final Color ALPHA_40 = new Color(0, 0, 0, 40); - private static final Color ALPHA_120 = new Color(0, 0, 0, 120); + private static final Color ALPHA_20 = Gray._0.withAlpha(20); + private static final Color ALPHA_30 = Gray._0.withAlpha(30); + private static final Color ALPHA_40 = Gray._0.withAlpha(40); + private static final Color ALPHA_120 = Gray._0.withAlpha(120); private static final BasicStroke BASIC_STROKE = new BasicStroke(); public void paintBackground(Graphics g, JComponent component, int state) { - if (state == ActionButtonComponent.NORMAL) return; - Dimension dimension = component.getSize(); + if (state != ActionButtonComponent.NORMAL) { + paintBackground(g, component.getSize(), state); + } + } + protected void paintBackground(Graphics g, Dimension size, int state) { if (UIUtil.isUnderAquaLookAndFeel()) { if (state == ActionButtonComponent.PUSHED) { - ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, ALPHA_40, dimension.width, dimension.height, ALPHA_20)); - g.fillRect(0, 0, dimension.width - 1, dimension.height - 1); + ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, ALPHA_40, size.width, size.height, ALPHA_20)); + g.fillRect(0, 0, size.width - 1, size.height - 1); g.setColor(ALPHA_120); - g.drawLine(0, 0, 0, dimension.height - 2); - g.drawLine(1, 0, dimension.width - 2, 0); + g.drawLine(0, 0, 0, size.height - 2); + g.drawLine(1, 0, size.width - 2, 0); g.setColor(ALPHA_30); - g.drawRect(1, 1, dimension.width - 3, dimension.height - 3); + g.drawRect(1, 1, size.width - 3, size.height - 3); + } else if (state == ActionButtonComponent.POPPED) { + ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, Gray._235, 0, size.height, Gray._200)); + g.fillRect(1, 1, size.width - 3, size.height - 3); } - else if (state == ActionButtonComponent.POPPED) { - ((Graphics2D)g).setPaint(UIUtil.getGradientPaint(0, 0, Gray._235, 0, dimension.height, Gray._200)); - g.fillRect(1, 1, dimension.width - 3, dimension.height - 3); - } - } - else { + } else { final Color bg = UIUtil.getPanelBackground(); final boolean dark = UIUtil.isUnderDarcula(); g.setColor(state == ActionButtonComponent.PUSHED ? ColorUtil.shift(bg, dark ? 1d / 0.7d : 0.7d) : dark ? Gray._255.withAlpha(40) : ALPHA_40); - g.fillRect(1, 1, dimension.width - 2, dimension.height - 2); + g.fillRect(1, 1, size.width - 2, size.height - 2); } } public void paintBorder(Graphics g, JComponent component, int state) { - if (state == ActionButtonComponent.NORMAL) return; - Rectangle r = new Rectangle(component.getWidth(), component.getHeight()); + if (state != ActionButtonComponent.NORMAL) { + paintBorder(g, component.getSize(), state); + } + } + protected void paintBorder(Graphics g, Dimension size, int state) { if (UIUtil.isUnderAquaLookAndFeel()) { if (state == ActionButtonComponent.POPPED) { g.setColor(ALPHA_30); - g.drawRoundRect(r.x, r.y, r.width - 2, r.height - 2, 4, 4); + g.drawRoundRect(0, 0, size.width - 2, size.height - 2, 4, 4); } - } - else { + } else { final double shift = UIUtil.isUnderDarcula() ? 1/0.49 : 0.49; g.setColor(ColorUtil.shift(UIUtil.getPanelBackground(), shift)); ((Graphics2D)g).setStroke(BASIC_STROKE); final GraphicsConfig config = GraphicsUtil.setupAAPainting(g); - g.drawRoundRect(r.x, r.y, r.width - 2, r.height - 2, 4, 4); + g.drawRoundRect(0, 0, size.width - 2, size.height - 2, 4, 4); config.restore(); } } public void paintIcon(Graphics g, ActionButtonComponent actionButton, Icon icon) { - int width = icon.getIconWidth(); - int height = icon.getIconHeight(); - int x = (int)Math.ceil((actionButton.getWidth() - width) / 2); - int y = (int)Math.ceil((actionButton.getHeight() - height) / 2); + final int width = icon.getIconWidth(); + final int height = icon.getIconHeight(); + final int x = (int)Math.ceil((actionButton.getWidth() - width) / 2); + final int y = (int)Math.ceil((actionButton.getHeight() - height) / 2); paintIconAt(g, actionButton, icon, x, y); } diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PoppedIcon.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PoppedIcon.java new file mode 100644 index 000000000000..72da27dd6d2b --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/PoppedIcon.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.openapi.actionSystem.impl; + +import com.intellij.openapi.actionSystem.ActionButtonComponent; + +import javax.swing.*; +import java.awt.*; + +/** + * A wrapper for an icon which paints it like a selected toggleable action in toolbar + * + * @author Konstantin Bulenkov + */ +public class PoppedIcon implements Icon { + private final Icon myIcon; + private final int myWidth; + private final int myHeight; + private IdeaActionButtonLook myLook = new IdeaActionButtonLook(); + + public PoppedIcon(Icon icon, int width, int height) { + myIcon = icon; + myWidth = width; + myHeight = height; + } + + public PoppedIcon(Icon icon) { + this(icon, icon.getIconWidth(), icon.getIconHeight()); + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + final Dimension size = new Dimension(getIconWidth() + 2*x, getIconHeight() + 2*x); + myLook.paintBackground(g, size, ActionButtonComponent.POPPED); + myLook.paintBorder(g, size, ActionButtonComponent.POPPED); + myIcon.paintIcon(c, g, x + (getIconWidth() - myIcon.getIconWidth())/2, y + (getIconHeight() - myIcon.getIconHeight())/2); + } + + @Override + public int getIconWidth() { + return myWidth; + } + + @Override + public int getIconHeight() { + return myHeight; + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/command/impl/DocumentReferenceManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/command/impl/DocumentReferenceManagerImpl.java index 594b0539f578..22ecc747e70e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/command/impl/DocumentReferenceManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/command/impl/DocumentReferenceManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +53,7 @@ public class DocumentReferenceManagerImpl extends DocumentReferenceManager imple public void initComponent() { VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() { @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { VirtualFile f = event.getFile(); DocumentReference ref = myDeletedFilePathToRef.remove(new FilePath(f.getUrl())); if (ref != null) { @@ -63,13 +63,13 @@ public class DocumentReferenceManagerImpl extends DocumentReferenceManager imple } @Override - public void beforeFileDeletion(VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull VirtualFileEvent event) { VirtualFile f = event.getFile(); f.putUserData(DELETED_FILES, collectDeletedFiles(f, new ArrayList<VirtualFile>())); } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { VirtualFile f = event.getFile(); List<VirtualFile> files = f.getUserData(DELETED_FILES); f.putUserData(DELETED_FILES, null); diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java index 164b5b48da6d..58ffaf58e2a0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/DirectoryBasedStorage.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,19 +72,19 @@ public class DirectoryBasedStorage implements StateStorage, Disposable { final Listener listener = messageBus.syncPublisher(STORAGE_TOPIC); virtualFileTracker.addTracker(fileUrl, new VirtualFileAdapter() { @Override - public void contentsChanged(final VirtualFileEvent event) { + public void contentsChanged(@NotNull final VirtualFileEvent event) { if (!StringUtil.endsWithIgnoreCase(event.getFile().getName(), ".xml")) return; listener.storageFileChanged(event, DirectoryBasedStorage.this); } @Override - public void fileDeleted(final VirtualFileEvent event) { + public void fileDeleted(@NotNull final VirtualFileEvent event) { if (!StringUtil.endsWithIgnoreCase(event.getFile().getName(), ".xml")) return; listener.storageFileChanged(event, DirectoryBasedStorage.this); } @Override - public void fileCreated(final VirtualFileEvent event) { + public void fileCreated(@NotNull final VirtualFileEvent event) { if (!StringUtil.endsWithIgnoreCase(event.getFile().getName(), ".xml")) return; listener.storageFileChanged(event, DirectoryBasedStorage.this); } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java index 8334e81eafcb..42a24c490db2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/stores/FileBasedStorage.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. @@ -92,17 +92,17 @@ public class FileBasedStorage extends XmlElementStorage { final Listener listener = messageBus.syncPublisher(STORAGE_TOPIC); virtualFileTracker.addTracker(fileUrl, new VirtualFileAdapter() { @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { myCachedVirtualFile = null; } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { myCachedVirtualFile = null; } @Override - public void contentsChanged(final VirtualFileEvent event) { + public void contentsChanged(@NotNull final VirtualFileEvent event) { if (!isDisposed()) { listener.storageFileChanged(event, FileBasedStorage.this); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java index e1dec0c9559e..3dd9d1578432 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/ToggleAutoScrollAction.java @@ -27,7 +27,7 @@ import com.intellij.ui.ToggleActionButton; public class ToggleAutoScrollAction extends ToggleActionButton implements DumbAware { public ToggleAutoScrollAction() { - super("Auto Scroll", AllIcons.General.AutoscrollToSource); + super("Synchronize Scrolling", AllIcons.General.AutoscrollToSource); } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java index fbd04aa62711..62c73e2c76de 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java @@ -17,6 +17,7 @@ package com.intellij.openapi.diff.impl; import com.intellij.icons.AllIcons; import com.intellij.ide.actions.EditSourceAction; +import com.intellij.idea.ActionsBundle; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.Application; @@ -126,6 +127,9 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid private AnAction getEditSourceAction() { AnAction editSourceAction = new EditSourceAction(); editSourceAction.getTemplatePresentation().setIcon(AllIcons.Actions.EditSource); + editSourceAction.getTemplatePresentation().setText(ActionsBundle.actionText("EditSource")); + editSourceAction.getTemplatePresentation().setDescription(ActionsBundle.actionText("EditSource")); + editSourceAction.registerCustomShortcutSet(CommonShortcuts.getEditSource(), myPanel, DiffPanelImpl.this); return editSourceAction; } }; @@ -202,9 +206,6 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid } private void registerActions() { - // EditSourceAction is not enabled in modal context, so we need to register it here explicitly - new EditSourceAction().registerCustomShortcutSet(CommonShortcuts.getEditSource(), myPanel, this); - //control+tab switches editors new AnAction(){ @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/FrameDiffTool.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/FrameDiffTool.java index d3f226decfe5..477835c682a2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/FrameDiffTool.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/external/FrameDiffTool.java @@ -197,10 +197,8 @@ public class FrameDiffTool implements DiffTool { String message = Arrays.equals(bytes1, bytes2) ? DiffBundle.message("diff.contents.are.identical.message.text") : DiffBundle.message("diff.contents.have.differences.only.in.line.separators.message.text"); - Messages.showInfoMessage(data.getProject(), message, DiffBundle.message("no.differences.dialog.title")); - return false; - //return Messages.showDialog(data.getProject(), message + "\nShow diff anyway?", "No Differences", new String[]{"Yes", "No"}, 1, - // Messages.getQuestionIcon()) == 0; + return Messages.showYesNoDialog(data.getProject(), message + "\n" + DiffBundle.message("show.diff.anyway.dialog.message"), + DiffBundle.message("no.differences.dialog.title"), Messages.getQuestionIcon()) == Messages.YES; } public boolean canShow(DiffRequest data) { diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java index b17dc4d33397..2c1b1e267b15 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/MergeList.java @@ -40,6 +40,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -60,10 +61,16 @@ public class MergeList implements UserDataHolder { @NotNull private final UserDataHolderBase myDataHolder = new UserDataHolderBase(); @NotNull private final ChangeList myBaseToLeftChangeList; @NotNull private final ChangeList myBaseToRightChangeList; + @Nullable private final String myErrorMessage; - private MergeList(@Nullable Project project, @NotNull Document left, @NotNull Document base, @NotNull Document right) { + private MergeList(@Nullable Project project, + @NotNull Document left, + @NotNull Document base, + @NotNull Document right, + @Nullable String errorMessage) { myBaseToLeftChangeList = new ChangeList(base, left, project); myBaseToRightChangeList = new ChangeList(base, right, project); + myErrorMessage = errorMessage; } @NotNull @@ -76,9 +83,9 @@ public class MergeList implements UserDataHolder { return myBaseToRightChangeList; } - public static MergeList create(@Nullable Project project, @NotNull Document left, @NotNull Document base, - @NotNull Document right) throws FilesTooBigForDiffException { - MergeList mergeList = new MergeList(project, left, base, right); + @NotNull + public static MergeList create(@Nullable Project project, @NotNull Document left, @NotNull Document base, @NotNull Document right) { + MergeList mergeList; String leftText = left.getText(); String baseText = base.getText(); String rightText = right.getText(); @@ -88,7 +95,15 @@ public class MergeList implements UserDataHolder { "\nRight\n", rightText }; ContextLogger logger = new ContextLogger(LOG, new ContextLogger.SimpleContext(data)); - List<MergeFragment> fragmentList = processText(leftText, baseText, rightText, logger); + List<MergeFragment> fragmentList; + try { + fragmentList = processText(leftText, baseText, rightText, logger); + mergeList = new MergeList(project, left, base, right, null); + } + catch (FilesTooBigForDiffException e) { + fragmentList = Collections.emptyList(); + mergeList = new MergeList(project, left, base, right, e.getMessage()); + } ArrayList<Change> leftChanges = new ArrayList<Change>(); ArrayList<Change> rightChanges = new ArrayList<Change>(); @@ -129,8 +144,11 @@ public class MergeList implements UserDataHolder { return mergeList; } - private static List<MergeFragment> processText(String leftText, String baseText, String rightText, - ContextLogger logger) throws FilesTooBigForDiffException { + @Nullable + private static List<MergeFragment> processText(@NotNull String leftText, + @NotNull String baseText, + @NotNull String rightText, + @NotNull ContextLogger logger) throws FilesTooBigForDiffException { DiffFragment[] leftFragments = DiffPolicy.DEFAULT_LINES.buildFragments(baseText, leftText); DiffFragment[] rightFragments = DiffPolicy.DEFAULT_LINES.buildFragments(baseText, rightText); int[] leftOffsets = {0, 0}; @@ -156,7 +174,7 @@ public class MergeList implements UserDataHolder { return builder.finish(leftText.length(), baseText.length(), rightText.length()); } - private static void getEqualRanges(DiffFragment fragment, int[] leftOffsets, TextRange[] equalRanges) { + private static void getEqualRanges(@NotNull DiffFragment fragment, @NotNull int[] leftOffsets, @NotNull TextRange[] equalRanges) { int baseLength = getTextLength(fragment.getText1()); int versionLength = getTextLength(fragment.getText2()); if (fragment.isEqual()) { @@ -170,11 +188,11 @@ public class MergeList implements UserDataHolder { leftOffsets[1] += versionLength; } - private static int getTextLength(String text1) { + private static int getTextLength(@Nullable String text1) { return text1 != null ? text1.length() : 0; } - public static MergeList create(DiffRequest data) throws FilesTooBigForDiffException { + public static MergeList create(@NotNull DiffRequest data) { DiffContent[] contents = data.getContents(); return create(data.getProject(), contents[0].getDocument(), contents[1].getDocument(), contents[2].getDocument()); } @@ -200,7 +218,7 @@ public class MergeList implements UserDataHolder { myBaseToRightChangeList.removeListener(listener); } - private void addActions(final FragmentSide side) { + private void addActions(@NotNull final FragmentSide side) { ChangeList changeList = getChanges(side); final FragmentSide originalSide = BRANCH_SIDE; for (int i = 0; i < changeList.getCount(); i++) { @@ -280,4 +298,8 @@ public class MergeList implements UserDataHolder { myBaseToRightChangeList.updateMarkup(); } + @Nullable + public String getErrorMessage() { + return myErrorMessage; + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java index 9ba62d5bcdf5..940128126dea 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/MergePanel2.java @@ -16,9 +16,11 @@ package com.intellij.openapi.diff.impl.incrementalMerge.ui; import com.intellij.icons.AllIcons; -import com.intellij.ide.actions.EditSourceAction; import com.intellij.openapi.Disposable; -import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.ActionManager; +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diff.*; @@ -226,28 +228,26 @@ public class MergePanel2 implements DiffViewer { private void tryInitView() { if (!hasAllEditors()) return; if (myMergeList != null) return; - try { - myMergeList = MergeList.create(myData); - myMergeList.addListener(myDividersRepainter); - myStatusUpdater = StatusUpdater.install(myMergeList, myPanel); - Editor left = getEditor(0); - Editor base = getEditor(1); - Editor right = getEditor(2); - - myMergeList.setMarkups(left, base, right); - EditingSides[] sides = {getFirstEditingSide(), getSecondEditingSide()}; - myScrollSupport.install(sides); - for (int i = 0; i < myDividers.length; i++) { - myDividers[i].listenEditors(sides[i]); - } - if (myScrollToFirstDiff) { - myPanel.requestScrollEditors(); - } - } - catch (final FilesTooBigForDiffException e) { + myMergeList = MergeList.create(myData); + myMergeList.addListener(myDividersRepainter); + myStatusUpdater = StatusUpdater.install(myMergeList, myPanel); + Editor left = getEditor(0); + Editor base = getEditor(1); + Editor right = getEditor(2); + + myMergeList.setMarkups(left, base, right); + EditingSides[] sides = {getFirstEditingSide(), getSecondEditingSide()}; + myScrollSupport.install(sides); + for (int i = 0; i < myDividers.length; i++) { + myDividers[i].listenEditors(sides[i]); + } + if (myScrollToFirstDiff) { + myPanel.requestScrollEditors(); + } + if (myMergeList.getErrorMessage() != null) { myPanel.insertTopComponent(new EditorNotificationPanel() { { - myLabel.setText(e.getMessage()); + myLabel.setText(myMergeList.getErrorMessage()); } }); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/OpenPartialDiffAction.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/OpenPartialDiffAction.java index c8c2bcd507b9..3193b0972d49 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/OpenPartialDiffAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/incrementalMerge/ui/OpenPartialDiffAction.java @@ -76,7 +76,7 @@ class OpenPartialDiffAction extends AnAction implements DumbAware { } private String composeName() { - if (myLeftIndex == 1 && myRightIndex == 0) { + if (myLeftIndex == 0 && myRightIndex == 1) { return DiffBundle.message("merge.partial.diff.action.name.0.1"); } if (myLeftIndex == 1 && myRightIndex == 2) { diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java b/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java index b2da49ef2008..e527964a5c0d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/impl/processing/TextCompareProcessor.java @@ -23,8 +23,10 @@ import com.intellij.openapi.diff.impl.fragments.LineFragment; import com.intellij.openapi.diff.impl.highlighting.FragmentSide; import com.intellij.openapi.diff.impl.highlighting.LineBlockDivider; import com.intellij.openapi.diff.impl.highlighting.Util; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.diff.FilesTooBigForDiffException; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import java.util.ArrayList; @@ -50,7 +52,9 @@ public class TextCompareProcessor { this(comparisonPolicy, DiffPolicy.LINES_WO_FORMATTING); } - public ArrayList<LineFragment> process(String text1, String text2) throws FilesTooBigForDiffException { + public ArrayList<LineFragment> process(@Nullable String text1, @Nullable String text2) throws FilesTooBigForDiffException { + text1 = StringUtil.notNullize(text1); + text2 = StringUtil.notNullize(text2); if (text1.isEmpty() || text2.isEmpty()) { return new DummyDiffFragmentsProcessor().process(text1, text2); } @@ -59,14 +63,22 @@ public class TextCompareProcessor { DiffFragment[] step1lineFragments = new DiffCorrection.TrueLineBlocks(myComparisonPolicy).correctAndNormalize(woFormattingBlocks); ArrayList<LineFragment> lineBlocks = new DiffFragmentsProcessor().process(step1lineFragments); + int badLinesCount = 0; if (mySearchForSubFragments) { for (LineFragment lineBlock : lineBlocks) { if (lineBlock.isOneSide() || lineBlock.isEqual()) continue; - String subText1 = lineBlock.getText(text1, FragmentSide.SIDE1); - String subText2 = lineBlock.getText(text2, FragmentSide.SIDE2); - ArrayList<LineFragment> subFragments = findSubFragments(subText1, subText2); - lineBlock.setChildren(new ArrayList<Fragment>(subFragments)); - lineBlock.adjustTypeFromChildrenTypes(); + try { + String subText1 = lineBlock.getText(text1, FragmentSide.SIDE1); + String subText2 = lineBlock.getText(text2, FragmentSide.SIDE2); + ArrayList<LineFragment> subFragments = findSubFragments(subText1, subText2); + lineBlock.setChildren(new ArrayList<Fragment>(subFragments)); + lineBlock.adjustTypeFromChildrenTypes(); + } + catch (FilesTooBigForDiffException ignore) { + // If we can't by-word compare two lines - this is not a reason to break entire diff. + badLinesCount++; + if (badLinesCount > FilesTooBigForDiffException.MAX_BAD_LINES) break; + } } } return lineBlocks; 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 e86bc16cd437..ce992c9c5d1d 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 @@ -614,7 +614,7 @@ public class EditorActionUtil { SelectionModel selectionModel = editor.getSelectionModel(); CaretModel caretModel = editor.getCaretModel(); if (isWithSelection) { - if (editor.isColumnMode()) { + if (editor.isColumnMode() && !caretModel.supportsMultipleCarets()) { selectionModel.setBlockSelection(blockSelectionStart, caretModel.getLogicalPosition()); } else { @@ -784,4 +784,43 @@ public class EditorActionUtil { public static void moveCaretToLineStartIgnoringSoftWraps(@NotNull Editor editor) { editor.getCaretModel().moveToLogicalPosition(EditorUtil.calcCaretLineRange(editor).first); } + + /** + * This method will make required expansions of collapsed region to make given offset 'visible'. + */ + public static void makePositionVisible(@NotNull final Editor editor, final int offset) { + FoldingModel foldingModel = editor.getFoldingModel(); + FoldRegion collapsedRegionAtOffset; + while ((collapsedRegionAtOffset = foldingModel.getCollapsedRegionAtOffset(offset)) != null) { + final FoldRegion region = collapsedRegionAtOffset; + foldingModel.runBatchFoldingOperation(new Runnable() { + @Override + public void run() { + region.setExpanded(true); + } + }); + } + } + + /** + * Clones caret in a given direction if it's possible. If there already exists a caret at the given direction, removes the current caret. + * + * @param editor editor to perform operation in + * @param caret caret to work on + * @param above whether to clone the caret above or below + * @return <code>false</code> if the operation cannot be performed due to current caret being at the edge (top or bottom) of the document, + * and <code>true</code> otherwise + */ + public static boolean cloneOrRemoveCaret(Editor editor, Caret caret, boolean above) { + if (above && caret.getLogicalPosition().line == 0) { + return false; + } + if (!above && caret.getLogicalPosition().line == editor.getDocument().getLineCount() - 1) { + return false; + } + if (caret.clone(above) == null) { + editor.getCaretModel().removeCaret(caret); + } + return true; + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretDownWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretDownWithSelectionAction.java index 607def608321..4f8c15f655b9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretDownWithSelectionAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretDownWithSelectionAction.java @@ -26,10 +26,11 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.CaretAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class MoveCaretDownWithSelectionAction extends EditorAction { public MoveCaretDownWithSelectionAction() { @@ -37,17 +38,28 @@ public class MoveCaretDownWithSelectionAction extends EditorAction { } private static class Handler extends EditorActionHandler { - public Handler() { - super(true); - } - @Override - public void execute(Editor editor, @NotNull Caret caret, DataContext dataContext) { - if (editor.isColumnMode() && editor.getCaretModel().supportsMultipleCarets()) { - caret.clone(false); + public void execute(Editor editor, @Nullable Caret caret, DataContext dataContext) { + if (!editor.getCaretModel().supportsMultipleCarets()) { + editor.getCaretModel().moveCaretRelatively(0, 1, true, editor.isColumnMode(), true); + return; + } + if (editor.isColumnMode()) { + EditorActionUtil.cloneOrRemoveCaret(editor, caret == null ? editor.getCaretModel().getPrimaryCaret() : caret, false); } else { - editor.getCaretModel().moveCaretRelatively(0, 1, true, editor.isColumnMode(), true); + CaretAction caretAction = new CaretAction() { + @Override + public void perform(Caret caret) { + caret.moveCaretRelatively(0, 1, true, true); + } + }; + if (caret == null) { + editor.getCaretModel().runForEachCaret(caretAction); + } + else { + caretAction.perform(caret); + } } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretUpWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretUpWithSelectionAction.java index f4bb99ec2fa4..2c2b46a25a9d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretUpWithSelectionAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/MoveCaretUpWithSelectionAction.java @@ -25,11 +25,10 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.editor.Caret; -import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class MoveCaretUpWithSelectionAction extends EditorAction { public MoveCaretUpWithSelectionAction() { @@ -37,17 +36,28 @@ public class MoveCaretUpWithSelectionAction extends EditorAction { } private static class Handler extends EditorActionHandler { - public Handler() { - super(true); - } - @Override - public void execute(Editor editor, @NotNull Caret caret, DataContext dataContext) { - if (editor.isColumnMode() && editor.getCaretModel().supportsMultipleCarets()) { - caret.clone(true); + public void execute(Editor editor, @Nullable Caret caret, DataContext dataContext) { + if (!editor.getCaretModel().supportsMultipleCarets()) { + editor.getCaretModel().moveCaretRelatively(0, -1, true, editor.isColumnMode(), true); + return; + } + if (editor.isColumnMode()) { + EditorActionUtil.cloneOrRemoveCaret(editor, caret == null ? editor.getCaretModel().getPrimaryCaret() : caret, true); } else { - editor.getCaretModel().moveCaretRelatively(0, -1, true, editor.isColumnMode(), true); + CaretAction caretAction = new CaretAction() { + @Override + public void perform(Caret caret) { + caret.moveCaretRelatively(0, -1, true, true); + } + }; + if (caret == null) { + editor.getCaretModel().runForEachCaret(caretAction); + } + else { + caretAction.perform(caret); + } } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageDownWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageDownWithSelectionAction.java index 07b6b6672ce8..36cc48608d90 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageDownWithSelectionAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageDownWithSelectionAction.java @@ -26,31 +26,43 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.CaretAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class PageDownWithSelectionAction extends EditorAction { public static class Handler extends EditorActionHandler { - public Handler() { - super(true); - } - @Override - public void execute(Editor editor, @NotNull Caret caret, DataContext dataContext) { - if (editor.isColumnMode() && editor.getCaretModel().supportsMultipleCarets()) { + public void execute(final Editor editor, @Nullable Caret caret, DataContext dataContext) { + if (!editor.getCaretModel().supportsMultipleCarets()) { + EditorActionUtil.moveCaretPageDown(editor, true); + return; + } + if (editor.isColumnMode()) { int lines = editor.getScrollingModel().getVisibleArea().height / editor.getLineHeight(); - Caret currentCaret = caret; + Caret currentCaret = caret == null ? editor.getCaretModel().getPrimaryCaret() : caret; for (int i = 0; i < lines; i++) { - currentCaret = currentCaret.clone(false); - if (currentCaret == null) { + if (!EditorActionUtil.cloneOrRemoveCaret(editor, currentCaret, false)) { break; } + currentCaret = editor.getCaretModel().getPrimaryCaret(); } } else { - EditorActionUtil.moveCaretPageDown(editor, true); + if (caret == null) { + editor.getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + EditorActionUtil.moveCaretPageDown(editor, true); + } + }); + } + else { + // assuming caret is equal to CaretModel.getCurrentCaret() + EditorActionUtil.moveCaretPageDown(editor, true); + } } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageUpWithSelectionAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageUpWithSelectionAction.java index e5a6a08fa256..4614703c8700 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageUpWithSelectionAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/PageUpWithSelectionAction.java @@ -25,32 +25,44 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.CaretAction; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.actionSystem.EditorAction; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.actionSystem.DataContext; -import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class PageUpWithSelectionAction extends EditorAction { public static class Handler extends EditorActionHandler { - public Handler() { - super(true); - } - @Override - public void execute(Editor editor, @NotNull Caret caret, DataContext dataContext) { - if (editor.isColumnMode() && editor.getCaretModel().supportsMultipleCarets()) { + public void execute(final Editor editor, @Nullable Caret caret, DataContext dataContext) { + if (!editor.getCaretModel().supportsMultipleCarets()) { + EditorActionUtil.moveCaretPageUp(editor, true); + return; + } + if (editor.isColumnMode()) { int lines = editor.getScrollingModel().getVisibleArea().height / editor.getLineHeight(); - Caret currentCaret = caret; + Caret currentCaret = caret == null ? editor.getCaretModel().getPrimaryCaret() : caret; for (int i = 0; i < lines; i++) { - currentCaret = currentCaret.clone(true); - if (currentCaret == null) { + if (!EditorActionUtil.cloneOrRemoveCaret(editor, currentCaret, true)) { break; } + currentCaret = editor.getCaretModel().getPrimaryCaret(); } } else { - EditorActionUtil.moveCaretPageUp(editor, true); + if (caret == null) { + editor.getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + EditorActionUtil.moveCaretPageUp(editor, true); + } + }); + } + else { + // assuming caret is equal to CaretModel.getCurrentCaret() + EditorActionUtil.moveCaretPageUp(editor, true); + } } } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleColumnModeAction.java b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleColumnModeAction.java index 64659ce3a5a0..a3b3446139e1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleColumnModeAction.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/actions/ToggleColumnModeAction.java @@ -27,33 +27,43 @@ package com.intellij.openapi.editor.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.ToggleAction; +import com.intellij.openapi.editor.Caret; import com.intellij.openapi.editor.CaretModel; import com.intellij.openapi.editor.LogicalPosition; import com.intellij.openapi.editor.SelectionModel; import com.intellij.openapi.editor.ex.EditorEx; import com.intellij.openapi.project.DumbAware; +import java.util.List; + public class ToggleColumnModeAction extends ToggleAction implements DumbAware { @Override public void setSelected(AnActionEvent e, boolean state) { final EditorEx editor = getEditor(e); - if (editor.getCaretModel().supportsMultipleCarets()) { - editor.setColumnMode(state); - return; - } final SelectionModel selectionModel = editor.getSelectionModel(); + final CaretModel caretModel = editor.getCaretModel(); if (state) { + caretModel.removeSecondaryCarets(); boolean hasSelection = selectionModel.hasSelection(); int selStart = selectionModel.getSelectionStart(); int selEnd = selectionModel.getSelectionEnd(); - final CaretModel caretModel = editor.getCaretModel(); - LogicalPosition blockStart = selStart == caretModel.getOffset() + LogicalPosition blockStart, blockEnd; + if (caretModel.supportsMultipleCarets()) { + LogicalPosition logicalSelStart = editor.offsetToLogicalPosition(selStart); + LogicalPosition logicalSelEnd = editor.offsetToLogicalPosition(selEnd); + int caretOffset = caretModel.getOffset(); + blockStart = selStart == caretOffset ? logicalSelEnd : logicalSelStart; + blockEnd = selStart == caretOffset ? logicalSelStart : logicalSelEnd; + } + else { + blockStart = selStart == caretModel.getOffset() + ? caretModel.getLogicalPosition() + : editor.offsetToLogicalPosition(selStart); + blockEnd = selEnd == caretModel.getOffset() ? caretModel.getLogicalPosition() - : editor.offsetToLogicalPosition(selStart); - LogicalPosition blockEnd = selEnd == caretModel.getOffset() - ? caretModel.getLogicalPosition() - : editor.offsetToLogicalPosition(selEnd); + : editor.offsetToLogicalPosition(selEnd); + } editor.setColumnMode(true); if (hasSelection) { selectionModel.setBlockSelection(blockStart, blockEnd); @@ -63,14 +73,29 @@ public class ToggleColumnModeAction extends ToggleAction implements DumbAware { } } else { - final boolean hasSelection = selectionModel.hasBlockSelection(); + boolean hasSelection = selectionModel.hasBlockSelection(); final LogicalPosition blockStart = selectionModel.getBlockStart(); final LogicalPosition blockEnd = selectionModel.getBlockEnd(); int selStart = hasSelection && blockStart != null ? editor.logicalPositionToOffset(blockStart) : 0; int selEnd = hasSelection && blockEnd != null ? editor.logicalPositionToOffset(blockEnd) : 0; + if (caretModel.supportsMultipleCarets()) { + hasSelection = true; + List<Caret> allCarets = caretModel.getAllCarets(); + Caret fromCaret = allCarets.get(0); + Caret toCaret = allCarets.get(allCarets.size() - 1); + if (fromCaret == caretModel.getPrimaryCaret()) { + Caret tmp = fromCaret; + fromCaret = toCaret; + toCaret = tmp; + } + selStart = fromCaret.getLeadSelectionOffset(); + selEnd = toCaret.getSelectionStart() == toCaret.getLeadSelectionOffset() ? toCaret.getSelectionEnd() : toCaret.getSelectionStart(); + } + editor.setColumnMode(false); + caretModel.removeSecondaryCarets(); if (hasSelection) { selectionModel.setSelection(selStart, selEnd); } 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 a425b6079cac..287f23cf8c6d 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 @@ -52,6 +52,10 @@ public interface EditorEx extends Editor { @Override DocumentEx getDocument(); + @Override + @NotNull + MarkupModelEx getMarkupModel(); + @NotNull EditorGutterComponentEx getGutterComponentEx(); 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 c1f1b5a144c5..012410d34fe3 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 @@ -36,15 +36,16 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.awt.*; +import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import java.util.Arrays; import java.util.List; -public class EditorUtil { +public final class EditorUtil { + private static final Logger LOG = Logger.getInstance(EditorUtil.class); - private static final Logger LOG = Logger.getInstance("#" + EditorUtil.class.getName()); - - private EditorUtil() { } + private EditorUtil() { + } public static int getLastVisualLineColumnNumber(@NotNull Editor editor, final int line) { Document document = editor.getDocument(); @@ -191,7 +192,7 @@ public class EditorUtil { if (!filler.isEmpty()) { new WriteAction(){ @Override - protected void run(final Result result) throws Throwable { + protected void run(@NotNull Result result) throws Throwable { editor.getDocument().insertString(offset, filler); editor.getCaretModel().moveToOffset(offset + filler.length()); } @@ -792,6 +793,19 @@ public class EditorUtil { int end = ends.length > 0 ? ends[ends.length - 1] : selection.getSelectionEnd(); return TextRange.create(start, end); } + + public static int yPositionToLogicalLine(@NotNull Editor editor, @NotNull MouseEvent event) { + return yPositionToLogicalLine(editor, event.getY()); + } + + public static int yPositionToLogicalLine(@NotNull Editor editor, @NotNull Point point) { + return yPositionToLogicalLine(editor, point.y); + } + + public static int yPositionToLogicalLine(@NotNull Editor editor, int y) { + int line = y / editor.getLineHeight(); + return line > 0 ? editor.visualToLogicalPosition(new VisualPosition(line, 0)).line : 0; + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java index cb0aee733817..72de1c92bbab 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/CaretModelImpl.java @@ -271,7 +271,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, @Override @NotNull - public Collection<Caret> getAllCarets() { + public List<Caret> getAllCarets() { List<Caret> carets; synchronized (myCarets) { carets = new ArrayList<Caret>(myCarets); @@ -452,7 +452,7 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, } @Override - public void setCarets(@NotNull final List<LogicalPosition> caretPositions, @NotNull final List<? extends Segment> selections) { + public void setCaretsAndSelections(@NotNull final List<LogicalPosition> caretPositions, @NotNull final List<? extends Segment> selections) { myEditor.assertIsDispatchThread(); if (caretPositions.isEmpty()) { throw new IllegalArgumentException("At least one caret should exist"); @@ -475,7 +475,9 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener, } else { caret = new CaretImpl(myEditor); - caret.moveToLogicalPosition(caretPosition, false, null, false); + if (caretPosition != null) { + caret.moveToLogicalPosition(caretPosition, false, null, false); + } synchronized (myCarets) { myCarets.add(caret); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java index 2b3ae68232e9..33cebb543c6f 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorGutterComponentImpl.java @@ -1118,7 +1118,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse if (toolTip != null && !toolTip.isEmpty()) { final Ref<Point> t = new Ref<Point>(e.getPoint()); - int line = myEditor.yPositionToLogicalLine(e.getY()); + int line = EditorUtil.yPositionToLogicalLine(myEditor, e); ArrayList<GutterMark> row = myLineToGutterRenderers.get(line); Balloon.Position ballPosition = Balloon.Position.atRight; if (row != null) { @@ -1182,7 +1182,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } private int getLineNumAtPoint(final Point clickPoint) { - return myEditor.yPositionToLogicalLine(clickPoint.y); + return EditorUtil.yPositionToLogicalLine(myEditor, clickPoint); } @Nullable @@ -1346,7 +1346,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse actionGroup.add(new CloseAnnotationsAction()); final List<AnAction> addActions = new ArrayList<AnAction>(); final Point p = e.getPoint(); - int line = myEditor.yPositionToLogicalLine((int)p.getY()); + int line = EditorUtil.yPositionToLogicalLine(myEditor, p); //if (line >= myEditor.getDocument().getLineCount()) return; for (TextAnnotationGutterProvider gutterProvider : myTextAnnotationGutters) { @@ -1405,7 +1405,7 @@ class EditorGutterComponentImpl extends EditorGutterComponentEx implements Mouse } private int convertPointToLineNumber(final Point p) { - int line = myEditor.yPositionToLogicalLine((int)p.getY()); + int line = EditorUtil.yPositionToLogicalLine(myEditor, p); if (line >= myEditor.getDocument().getLineCount()) return -1; int startOffset = myEditor.getDocument().getLineStartOffset(line); 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 fc68bf4a1ffa..aa04b488cf29 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 @@ -536,7 +536,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } }); } - updateHasTabsFlag(document.getCharsSequence()); + updateHasTabsFlag(document.getImmutableCharSequence()); } public static boolean isPresentationMode(Project project) { @@ -628,7 +628,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi @Override @NotNull - public MarkupModel getMarkupModel() { + public MarkupModelEx getMarkupModel() { return myMarkupModel; } @@ -1036,7 +1036,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi }; Disposer.register(myDisposable, myHighlighterDisposable); highlighter.setEditor(this); - highlighter.setText(document.getCharsSequence()); + highlighter.setText(document.getImmutableCharSequence()); EditorHighlighterCache.rememberEditorHighlighterForCachesOptimization(document, highlighter); if (myPanel != null) { @@ -1112,15 +1112,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi return y / getLineHeight(); } - public int yPositionToLogicalLine(int y) { - int line = yPositionToVisibleLine(y); - if (line <= 0) { - return 0; - } - LogicalPosition logicalPosition = visualToLogicalPosition(new VisualPosition(line, 0)); - return logicalPosition.line; - } - @Override @NotNull public VisualPosition xyToVisualPosition(@NotNull Point p) { @@ -1140,7 +1131,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi // We mark that we're under such circumstances then. boolean activeSoftWrapProcessed = logicalPosition.softWrapLinesOnCurrentLogicalLine <= 0; - CharSequence text = myDocument.getCharsSequence(); + CharSequence text = myDocument.getImmutableCharSequence(); LogicalPosition endLogicalPosition = visualToLogicalPosition(new VisualPosition(line + 1, 0)); int endOffset = logicalPositionToOffset(endLogicalPosition); @@ -1324,7 +1315,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi return mySoftWrapModel.offsetToLogicalPosition(offset); } int line = offsetToLogicalLine(offset, false); - int column = calcColumnNumber(offset, line, false, myDocument.getCharsSequence()); + int column = calcColumnNumber(offset, line, false, myDocument.getImmutableCharSequence()); return new LogicalPosition(line, column); } @@ -1372,7 +1363,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi @NotNull public LogicalPosition xyToLogicalPosition(@NotNull Point p) { Point pp = p.x >= 0 && p.y >= 0 ? p : new Point(Math.max(p.x, 0), Math.max(p.y, 0)); - return visualToLogicalPosition(xyToVisualPosition(pp)); } @@ -1526,7 +1516,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi } int offset = startOffset; - CharSequence text = myDocument.getCharsSequence(); + CharSequence text = myDocument.getImmutableCharSequence(); int textLength = myDocument.getTextLength(); // We need to calculate max offset to provide to the IterationState here based on the given start offset and target @@ -2287,7 +2277,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi // background is already drawn. boolean[] caretRowPainted = new boolean[1]; - CharSequence text = myDocument.getCharsSequence(); + CharSequence text = myDocument.getImmutableCharSequence(); while (!iterationState.atEnd() && !lIterator.atEnd()) { int hEnd = iterationState.getEndOffset(); @@ -2382,7 +2372,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi validateSize(); // Repaint editor to the bottom in order to ensure that its content is shown correctly after new soft wrap introduction. - repaintToScreenBottom(yPositionToLogicalLine(position.y)); + repaintToScreenBottom(EditorUtil.yPositionToLogicalLine(this, position)); // Repaint gutter at all space that is located after active clip in order to ensure that line numbers are correctly redrawn // in accordance with the newly introduced soft wrap(s). @@ -2748,7 +2738,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi int fontType = attributes.getFontType(); g.setColor(currentColor); - CharSequence chars = myDocument.getCharsSequence(); + CharSequence chars = myDocument.getImmutableCharSequence(); while (!iterationState.atEnd() && !lIterator.atEnd()) { int hEnd = iterationState.getEndOffset(); @@ -3623,7 +3613,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi if (pos.column == 0) return start; int end = myDocument.getLineEndOffset(pos.line); - CharSequence text = myDocument.getCharsSequence(); + CharSequence text = myDocument.getImmutableCharSequence(); return EditorUtil.calcOffset(this, text, start, end, pos.column, EditorUtil.getTabSize(this), debugBuffer); } @@ -3873,7 +3863,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi LOG.assertTrue(lineIndex >= 0 && lineIndex < myDocument.getLineCount()); if (softWrapAware && getSoftWrapModel().isSoftWrappingEnabled()) { - int column = calcColumnNumber(offset, lineIndex, false, myDocument.getCharsSequence()); + int column = calcColumnNumber(offset, lineIndex, false, myDocument.getImmutableCharSequence()); return mySoftWrapModel.adjustLogicalPosition(new LogicalPosition(lineIndex, column), offset).line; } else { @@ -3883,7 +3873,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi @Override public int calcColumnNumber(int offset, int lineIndex) { - return calcColumnNumber(offset, lineIndex, true, myDocument.getCharsSequence()); + return calcColumnNumber(offset, lineIndex, true, myDocument.getImmutableCharSequence()); } public int calcColumnNumber(int offset, int lineIndex, boolean softWrapAware, CharSequence documentCharSequence) { @@ -3954,7 +3944,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi if (!mySettings.isCaretInsideTabs()) { int offset = logicalPositionToOffset(new LogicalPosition(line, column)); - CharSequence text = myDocument.getCharsSequence(); + CharSequence text = myDocument.getImmutableCharSequence(); if (offset >= 0 && offset < myDocument.getTextLength()) { if (text.charAt(offset) == '\t') { column = calcColumnNumber(offset, line); @@ -4573,7 +4563,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi g.fillRect(x, y, width, lineHeight - 1); final LogicalPosition startPosition = caret == null ? getCaretModel().getLogicalPosition() : caret.getLogicalPosition(); final int offset = logicalPositionToOffset(startPosition); - CharSequence chars = myDocument.getCharsSequence(); + CharSequence chars = myDocument.getImmutableCharSequence(); if (chars.length() > offset && myDocument.getTextLength() > offset) { FoldRegion folding = myFoldingModel.getCollapsedRegionAtOffset(offset); final char ch; @@ -5283,7 +5273,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi private String getText(int startIdx, int endIdx) { if (startIdx >= 0 && endIdx > startIdx) { - CharSequence chars = getDocument().getCharsSequence(); + CharSequence chars = getDocument().getImmutableCharSequence(); return chars.subSequence(startIdx, endIdx).toString(); } @@ -5484,7 +5474,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi putUserData(EditorActionUtil.EXPECTED_CARET_OFFSET, null); if (event.getArea() == EditorMouseEventArea.LINE_MARKERS_AREA) { - myDragOnGutterSelectionStartLine = yPositionToLogicalLine(e.getY()); + myDragOnGutterSelectionStartLine = EditorUtil.yPositionToLogicalLine(EditorImpl.this, e); } // On some systems (for example on Linux) popup trigger is MOUSE_PRESSED event. @@ -6419,7 +6409,7 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi return; } - final CharSequence text = myDocument.getCharsSequence(); + final CharSequence text = myDocument.getImmutableCharSequence(); int documentLength = myDocument.getTextLength(); int x = 0; boolean lastLineLengthCalculated = false; @@ -6554,8 +6544,8 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi int endToUse = Math.min(lineCount, myLineWidths.size()); if (endToUse > 0 && getSoftWrapModel().isSoftWrappingEnabled()) { Rectangle visibleArea = getScrollingModel().getVisibleArea(); - startToUse = yPositionToLogicalLine(visibleArea.getLocation().y); - endToUse = Math.min(endToUse, yPositionToLogicalLine(visibleArea.y + visibleArea.height)); + startToUse = EditorUtil.yPositionToLogicalLine(EditorImpl.this, visibleArea.getLocation()); + endToUse = Math.min(endToUse, EditorUtil.yPositionToLogicalLine(EditorImpl.this, visibleArea.y + visibleArea.height)); if (endToUse <= startToUse) { // There is a possible case that there is the only soft-wrapped line, i.e. end == start. We still want to update the // size container's width then. diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorLastActionTrackerImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorLastActionTrackerImpl.java new file mode 100644 index 000000000000..e86e86247610 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorLastActionTrackerImpl.java @@ -0,0 +1,146 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.impl; + +import com.intellij.openapi.Disposable; +import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.actionSystem.ex.AnActionListener; +import com.intellij.openapi.components.ApplicationComponent; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.EditorFactory; +import com.intellij.openapi.editor.EditorLastActionTracker; +import com.intellij.openapi.editor.event.*; +import com.intellij.openapi.util.Disposer; +import com.intellij.openapi.util.Key; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public class EditorLastActionTrackerImpl extends EditorLastActionTracker implements ApplicationComponent, + AnActionListener, + EditorMouseListener { + private static final Key<Boolean> DISPOSABLE_SET = Key.create("EditorLastActionTracker.dispose.handler.set"); + + private final ActionManager myActionManager; + private final EditorEventMulticaster myEditorEventMulticaster; + + private String myLastActionId; + private Editor myCurrentEditor; + private Editor myLastEditor; + + EditorLastActionTrackerImpl(ActionManager actionManager, EditorFactory editorFactory) { + myActionManager = actionManager; + myEditorEventMulticaster = editorFactory.getEventMulticaster(); + } + + @Override + public void initComponent() { + myActionManager.addAnActionListener(this); + myEditorEventMulticaster.addEditorMouseListener(this); + } + + @Override + public void disposeComponent() { + myEditorEventMulticaster.removeEditorMouseListener(this); + myActionManager.removeAnActionListener(this); + } + + @NotNull + @Override + public String getComponentName() { + return "EditorLastActionTracker"; + } + + @Override + @Nullable + public String getLastActionId() { + return myLastActionId; + } + + @Override + public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { + myCurrentEditor = CommonDataKeys.EDITOR.getData(dataContext); + registerDisposeHandler(myCurrentEditor); + if (myCurrentEditor != myLastEditor) { + resetLastAction(); + } + } + + @Override + public void afterActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) { + myLastActionId = getActionId(action); + myLastEditor = myCurrentEditor; + myCurrentEditor = null; + } + + @Override + public void beforeEditorTyping(char c, DataContext dataContext) { + resetLastAction(); + } + + @Override + public void mousePressed(EditorMouseEvent e) { + resetLastAction(); + } + + @Override + public void mouseClicked(EditorMouseEvent e) { + resetLastAction(); + } + + @Override + public void mouseReleased(EditorMouseEvent e) { + resetLastAction(); + } + + @Override + public void mouseEntered(EditorMouseEvent e) { + + } + + @Override + public void mouseExited(EditorMouseEvent e) { + + } + + private String getActionId(AnAction action) { + return action instanceof ActionStub ? ((ActionStub)action).getId() : myActionManager.getId(action); + } + + private void resetLastAction() { + myLastActionId = null; + myLastEditor = null; + } + + private void registerDisposeHandler(final Editor editor) { + if (!(editor instanceof EditorImpl)) { + return; + } + EditorImpl editorImpl = (EditorImpl)editor; + if (editorImpl.replace(DISPOSABLE_SET, null, Boolean.TRUE)) { + Disposer.register(editorImpl.getDisposable(), new Disposable() { + @Override + public void dispose() { + if (myCurrentEditor == editor) { + myCurrentEditor = null; + } + if (myLastEditor == editor) { + myLastEditor = null; + } + } + }); + } + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java index 90780f19bf46..46be8b85a5cf 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/SelectionModelImpl.java @@ -249,7 +249,7 @@ public class SelectionModelImpl implements SelectionModel, PrioritizedDocumentLi } } } - myEditor.getCaretModel().setCarets(positions, selections); + myEditor.getCaretModel().setCaretsAndSelections(positions, selections); } else { removeSelection(); diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaretModel.java b/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaretModel.java index 32e8f3b66592..607e182dd3cb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaretModel.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/textarea/TextComponentCaretModel.java @@ -25,7 +25,6 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.text.BadLocationException; import javax.swing.text.JTextComponent; -import java.util.Collection; import java.util.Collections; import java.util.List; @@ -154,8 +153,8 @@ public class TextComponentCaretModel implements CaretModel { @NotNull @Override - public Collection<Caret> getAllCarets() { - return Collections.singleton(myCaret); + public List<Caret> getAllCarets() { + return Collections.singletonList(myCaret); } @Nullable @@ -180,7 +179,7 @@ public class TextComponentCaretModel implements CaretModel { } @Override - public void setCarets(@NotNull List<LogicalPosition> caretPositions, @NotNull List<? extends Segment> selections) { + public void setCaretsAndSelections(@NotNull List<LogicalPosition> caretPositions, @NotNull List<? extends Segment> selections) { throw new UnsupportedOperationException("Multiple carets are not supported"); } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java index b1165471f28f..d585ec5a7b7d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.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. @@ -335,15 +335,11 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD ApplicationManager.getApplication().getMessageBus().connect(getDisposable()) - .subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() { + .subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() { @Override public void applicationActivated(IdeFrame ideFrame) { SaveAndSyncHandlerImpl.getInstance().maybeRefresh(ModalityState.current()); } - - @Override - public void applicationDeactivated(IdeFrame ideFrame) { - } }); return panel; diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileTreeBuilder.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileTreeBuilder.java index b5bc328d7b4e..79801a4f74c1 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileTreeBuilder.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileTreeBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,19 +67,19 @@ public class FileTreeBuilder extends AbstractTreeBuilder { private void installVirtualFileListener() { VirtualFileAdapter myVirtualFileListener = new VirtualFileAdapter() { - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { getUpdater().addSubtreeToUpdate(getRootNode()); } - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { getUpdater().addSubtreeToUpdate(getRootNode()); } - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { getUpdater().addSubtreeToUpdate(getRootNode()); } - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { getUpdater().addSubtreeToUpdate(getRootNode()); } }; 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 new file mode 100644 index 000000000000..5ef017382026 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorEmptyTextPainter.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.openapi.fileEditor.impl; + +import com.intellij.ide.actions.ActivateToolWindowAction; +import com.intellij.ide.actions.ShowFilePathAction; +import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.actionSystem.Shortcut; +import com.intellij.openapi.keymap.KeymapManager; +import com.intellij.openapi.keymap.KeymapUtil; +import com.intellij.openapi.keymap.MacKeymapUtil; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Pair; +import com.intellij.openapi.util.SystemInfo; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.wm.ToolWindow; +import com.intellij.openapi.wm.ToolWindowId; +import com.intellij.openapi.wm.ToolWindowManager; +import com.intellij.openapi.wm.impl.IdeFrameImpl; +import com.intellij.ui.Gray; +import com.intellij.ui.JBColor; +import com.intellij.util.PairFunction; +import com.intellij.util.ui.GraphicsUtil; +import com.intellij.util.ui.UIUtil; + +import javax.swing.*; +import java.awt.*; + +/** + * @author gregsh + */ +public class EditorEmptyTextPainter { + + public void paintEmptyText(final EditorsSplitters splitters, Graphics g) { + boolean isDarkBackground = UIUtil.isUnderDarcula(); + UIUtil.applyRenderingHints(g); + GraphicsUtil.setupAntialiasing(g, true, false); + g.setColor(new JBColor(isDarkBackground ? Gray._230 : Gray._80, Gray._160)); + g.setFont(UIUtil.getLabelFont().deriveFont(isDarkBackground ? 24f : 20f)); + + UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.5f); + painter.withShadow(true, new JBColor(Gray._200.withAlpha(100), Gray._0.withAlpha(255))); + + painter.appendLine("No files are open").underlined(new JBColor(Gray._150, Gray._180)); + + advertiseActions(splitters, painter); + + painter.draw(g, new PairFunction<Integer, Integer, Pair<Integer, Integer>>() { + @Override + public Pair<Integer, Integer> fun(Integer width, Integer height) { + Dimension s = splitters.getSize(); + return Pair.create((s.width - width) / 2, (s.height - height) / 2); + } + }); + } + + protected void advertiseActions(EditorsSplitters splitters, UIUtil.TextPainter painter) { + appendSearchEverywhere(painter); + appendToolWindow(painter, "Open Project View", ToolWindowId.PROJECT_VIEW, splitters); + appendAction(painter, "Open a file by name", getActionShortcutText("GotoFile")); + appendAction(painter, "Open Recent Files", getActionShortcutText(IdeActions.ACTION_RECENT_FILES)); + appendAction(painter, "Open Navigation Bar", getActionShortcutText("ShowNavBar")); + appendLine(painter, "Drag and Drop file(s) here from " + ShowFilePathAction.getFileManagerName()); + } + + protected void appendSearchEverywhere(UIUtil.TextPainter painter) { + Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_SEARCH_EVERYWHERE); + if (shortcuts.length == 0) { + appendAction(painter, "Search Everywhere", "Double " + (SystemInfo.isMac ? MacKeymapUtil.SHIFT : "Shift")); + } + else { + appendAction(painter, "Search Everywhere", KeymapUtil.getShortcutsText(shortcuts)); + } + } + + protected void appendToolWindow(UIUtil.TextPainter painter, String action, String toolWindowId, EditorsSplitters splitters) { + if (!isToolwindowVisible(splitters, toolWindowId)) { + String activateActionId = ActivateToolWindowAction.getActionIdForToolWindow(toolWindowId); + appendAction(painter, action, getActionShortcutText(activateActionId)); + } + } + + protected void appendAction(UIUtil.TextPainter painter, String action, String shortcut) { + if (StringUtil.isEmpty(shortcut)) return; + appendLine(painter, action + " with " + "<shortcut>" + shortcut + "</shortcut>"); + } + + protected void appendLine(UIUtil.TextPainter painter, String line) { + painter.appendLine(line).smaller().withBullet(); + } + + protected String getActionShortcutText(String actionId) { + return KeymapUtil.getFirstKeyboardShortcutText(actionId); + } + + protected static boolean isToolwindowVisible(EditorsSplitters splitters, String toolwindowId) { + final Window frame = SwingUtilities.getWindowAncestor(splitters); + if (frame instanceof IdeFrameImpl) { + final Project project = ((IdeFrameImpl)frame).getProject(); + if (project != null) { + if (!project.isInitialized()) return true; + ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(toolwindowId); + return toolWindow != null && toolWindow.isVisible(); + } + } + + return false; + } +} 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 7b095fa7af87..bc324618d973 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,38 +15,37 @@ */ package com.intellij.openapi.fileEditor.impl; -import com.intellij.ide.actions.ShowFilePathAction; import com.intellij.ide.ui.UISettings; -import com.intellij.openapi.actionSystem.IdeActions; -import com.intellij.openapi.actionSystem.KeyboardShortcut; -import com.intellij.openapi.actionSystem.Shortcut; 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.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.impl.text.FileDropHandler; -import com.intellij.openapi.keymap.*; +import com.intellij.openapi.keymap.Keymap; +import com.intellij.openapi.keymap.KeymapManager; +import com.intellij.openapi.keymap.KeymapManagerListener; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Splitter; -import com.intellij.openapi.util.*; -import com.intellij.openapi.vfs.VfsUtil; +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.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.wm.*; +import com.intellij.openapi.wm.FocusWatcher; +import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.ex.IdeFocusTraversalPolicy; import com.intellij.openapi.wm.ex.WindowManagerEx; import com.intellij.openapi.wm.impl.FrameTitleBuilder; -import com.intellij.openapi.wm.impl.IdeFrameImpl; import com.intellij.openapi.wm.impl.IdePanePanel; -import com.intellij.ui.Gray; import com.intellij.ui.JBColor; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.docking.DockManager; import com.intellij.ui.tabs.JBTabs; import com.intellij.util.Alarm; -import com.intellij.util.PairFunction; import com.intellij.util.containers.ArrayListSet; import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.ui.GraphicsUtil; import com.intellij.util.ui.UIUtil; import org.jdom.Element; import org.jetbrains.annotations.NotNull; @@ -70,6 +69,8 @@ public class EditorsSplitters extends IdePanePanel { private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.EditorsSplitters"); private static final String PINNED = "pinned"; + private final static EditorEmptyTextPainter ourPainter = ServiceManager.getService(EditorEmptyTextPainter.class); + private EditorWindow myCurrentWindow; final Set<EditorWindow> myWindows = new CopyOnWriteArraySet<EditorWindow>(); @@ -141,20 +142,6 @@ public class EditorsSplitters extends IdePanePanel { return myCurrentWindow == null || myCurrentWindow.getFiles().length == 0; } - private boolean isProjectViewVisible() { - final Window frame = SwingUtilities.getWindowAncestor(this); - if (frame instanceof IdeFrameImpl) { - final Project project = ((IdeFrameImpl)frame).getProject(); - if (project != null) { - if (!project.isInitialized()) return true; - ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW); - return toolWindow != null && toolWindow.isVisible(); - } - } - - return false; - } - @Override protected void paintComponent(Graphics g) { super.paintComponent(g); @@ -164,60 +151,11 @@ public class EditorsSplitters extends IdePanePanel { g.drawLine(0, 0, getWidth(), 0); } - boolean isDarkBackground = UIUtil.isUnderDarcula(); - if (showEmptyText()) { - UIUtil.applyRenderingHints(g); - GraphicsUtil.setupAntialiasing(g, true, false); - g.setColor(new JBColor(isDarkBackground ? Gray._230 : Gray._80, Gray._160)); - g.setFont(UIUtil.getLabelFont().deriveFont(isDarkBackground ? 24f : 20f)); - - final UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.5f); - painter.withShadow(true, new JBColor(Gray._200.withAlpha(100), Gray._0.withAlpha(255))); - - painter.appendLine("No files are open").underlined(new JBColor(Gray._150, Gray._180)); - - final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_SEARCH_EVERYWHERE); - final String everywhere; - if (shortcuts.length == 0) { - everywhere = "Search Everywhere with <shortcut>Double " + (SystemInfo.isMac ? MacKeymapUtil.SHIFT : "Shift"); - } else { - everywhere = "Search Everywhere <shortcut>" + KeymapUtil.getShortcutsText(shortcuts); - } - painter.appendLine(everywhere + "</shortcut>").smaller().withBullet(); - - if (!isProjectViewVisible()) { - painter.appendLine("Open Project View with <shortcut>" + KeymapUtil.getShortcutText(new KeyboardShortcut( - KeyStroke.getKeyStroke((SystemInfo.isMac ? "meta" : "alt") + " 1"), null)) + "</shortcut>").smaller().withBullet(); - } - - painter.appendLine("Open a file by name with " + getActionShortcutText("GotoFile")).smaller().withBullet() - .appendLine("Open Recent Files with " + getActionShortcutText(IdeActions.ACTION_RECENT_FILES)).smaller().withBullet() - .appendLine("Open Navigation Bar with " + getActionShortcutText("ShowNavBar")).smaller().withBullet() - .appendLine("Drag and Drop file(s) here from " + ShowFilePathAction.getFileManagerName()).smaller().withBullet() - .draw(g, new PairFunction<Integer, Integer, Pair<Integer, Integer>>() { - @Override - public Pair<Integer, Integer> fun(Integer width, Integer height) { - final Dimension s = getSize(); - return Pair.create((s.width - width) / 2, (s.height - height) / 2); - } - }); + ourPainter.paintEmptyText(this, g); } } - private static String getActionShortcutText(final String actionId) { - final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(actionId); - String shortcutText = ""; - for (final Shortcut shortcut : shortcuts) { - if (shortcut instanceof KeyboardShortcut) { - shortcutText = KeymapUtil.getShortcutText(shortcut); - break; - } - } - - return "<shortcut>" + shortcutText + "</shortcut>"; - } - public void writeExternal(final Element element) { if (getComponentCount() != 0) { final Component comp = getComponent(0); @@ -418,7 +356,7 @@ public class EditorsSplitters extends IdePanePanel { } } } - return VfsUtil.toVirtualFileArray(files); + return VfsUtilCore.toVirtualFileArray(files); } @NotNull public VirtualFile[] getSelectedFiles() { @@ -429,7 +367,7 @@ public class EditorsSplitters extends IdePanePanel { files.add(file); } } - final VirtualFile[] virtualFiles = VfsUtil.toVirtualFileArray(files); + final VirtualFile[] virtualFiles = VfsUtilCore.toVirtualFileArray(files); final VirtualFile currentFile = getCurrentFile(); if (currentFile != null) { for (int i = 0; i != virtualFiles.length; ++i) { 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 5c26205ea268..14af91d690f1 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 @@ -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. @@ -40,10 +40,7 @@ import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileEditor.*; import com.intellij.openapi.fileEditor.impl.text.TextEditorImpl; -import com.intellij.openapi.fileTypes.BinaryFileTypeDecompilers; -import com.intellij.openapi.fileTypes.FileType; -import com.intellij.openapi.fileTypes.FileTypeManager; -import com.intellij.openapi.fileTypes.UnknownFileType; +import com.intellij.openapi.fileTypes.*; import com.intellij.openapi.project.*; import com.intellij.openapi.project.ex.ProjectEx; import com.intellij.openapi.ui.DialogBuilder; @@ -93,6 +90,7 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl 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"); 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>(); @@ -513,7 +511,7 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } @Override - public void reloadFiles(final VirtualFile... files) { + public void reloadFiles(@NotNull final VirtualFile... files) { for (VirtualFile file : files) { if (file.exists()) { final Document doc = getCachedDocument(file); @@ -547,7 +545,7 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { final VirtualFile file = event.getFile(); if (VirtualFile.PROP_WRITABLE.equals(event.getPropertyName())) { final Document document = getCachedDocument(file); @@ -576,18 +574,18 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } } - private static boolean isBinaryWithDecompiler(VirtualFile file) { + private static boolean isBinaryWithDecompiler(@NotNull VirtualFile file) { final FileType ft = file.getFileType(); return ft.isBinary() && BinaryFileTypeDecompilers.INSTANCE.forFileType(ft) != null; } - private static boolean isBinaryWithoutDecompiler(VirtualFile file) { + private static boolean isBinaryWithoutDecompiler(@NotNull VirtualFile file) { final FileType fileType = file.getFileType(); return fileType.isBinary() && BinaryFileTypeDecompilers.INSTANCE.forFileType(fileType) == null; } @Override - public void contentsChanged(VirtualFileEvent event) { + public void contentsChanged(@NotNull VirtualFileEvent event) { if (event.isFromSave()) return; final VirtualFile file = event.getFile(); final Document document = getCachedDocument(file); @@ -716,11 +714,11 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { Document doc = getCachedDocument(event.getFile()); if (doc != null) { myTrailingSpacesStripper.documentDeleted(doc); @@ -728,24 +726,37 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { } @Override - public void fileCopied(VirtualFileCopyEvent event) { + public void fileCopied(@NotNull VirtualFileCopyEvent event) { fileCreated(event); } @Override - public void beforePropertyChange(VirtualFilePropertyEvent event) { + public void beforePropertyChange(@NotNull VirtualFilePropertyEvent event) { } @Override - public void beforeContentsChange(VirtualFileEvent event) { + public void beforeContentsChange(@NotNull VirtualFileEvent event) { + VirtualFile virtualFile = event.getFile(); + if (virtualFile.getFileType() == UnknownFileType.INSTANCE && virtualFile.getLength() == 0) { + virtualFile.putUserData(MUST_RECOMPUTE_FILE_TYPE, Boolean.TRUE); + } + } + + public static boolean recomputeFileTypeIfNecessary(@NotNull VirtualFile virtualFile) { + if (virtualFile.getUserData(MUST_RECOMPUTE_FILE_TYPE) != null) { + FileTypeRegistry.getInstance().detectFileTypeFromContent(virtualFile); + virtualFile.putUserData(MUST_RECOMPUTE_FILE_TYPE, null); + return true; + } + return false; } @Override - public void beforeFileDeletion(VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull VirtualFileEvent event) { /* if (!event.isFromRefresh()) { VirtualFile file = event.getFile(); @@ -768,7 +779,7 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } @Override - public void beforeFileMovement(VirtualFileMoveEvent event) { + public void beforeFileMovement(@NotNull VirtualFileMoveEvent event) { } @Override @@ -818,14 +829,15 @@ public class FileDocumentManagerImpl extends FileDocumentManager implements Appl } @NotNull - protected FileDocumentManagerListener[] getListeners() { + private static FileDocumentManagerListener[] getListeners() { return FileDocumentManagerListener.EP_NAME.getExtensions(); } private void handleErrorsOnSave(@NotNull Map<Document, IOException> failures) { if (ApplicationManager.getApplication().isUnitTestMode()) { - for (IOException exception : failures.values()) { - throw new RuntimeException(exception); + IOException ioException = failures.isEmpty() ? null : failures.values().iterator().next(); + if (ioException != null) { + throw new RuntimeException(ioException); } return; } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java index ed16bb677525..6e80c6da70fa 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/IdeDocumentHistoryImpl.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. @@ -136,7 +136,7 @@ public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements Projec VirtualFileListener fileListener = new VirtualFileAdapter() { @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { onFileDeleted(); } }; diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/TrailingSpacesStripper.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/TrailingSpacesStripper.java index 53b3e26df8c3..b4cc5fe9a240 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/TrailingSpacesStripper.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/TrailingSpacesStripper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,10 +21,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.CommandProcessor; -import com.intellij.openapi.editor.Document; -import com.intellij.openapi.editor.DocumentRunnable; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.VisualPosition; +import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -36,11 +33,11 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.util.text.CharArrayUtil; import gnu.trove.THashSet; -import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import java.awt.*; -import java.util.Set; +import java.util.*; +import java.util.List; public final class TrailingSpacesStripper extends FileDocumentManagerAdapter { @@ -129,18 +126,21 @@ public final class TrailingSpacesStripper extends FileDocumentManagerAdapter { // when virtual space enabled, we can strip whitespace anywhere boolean isVirtualSpaceEnabled = activeEditor == null || activeEditor.getSettings().isVirtualSpace(); - int caretLine = activeEditor == null ? -1 : activeEditor.getCaretModel().getLogicalPosition().line; - final EditorSettingsExternalizable settings = EditorSettingsExternalizable.getInstance(); if (settings == null) return; String stripTrailingSpaces = settings.getStripTrailingSpaces(); final boolean doStrip = !stripTrailingSpaces.equals(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_NONE); - final boolean inChangedLinesOnly = !stripTrailingSpaces.equals(EditorSettingsExternalizable.STRIP_TRAILING_SPACES_WHOLE); - if (!inChangedLinesOnly || !doStrip || isVirtualSpaceEnabled) caretLine = -1; - ((DocumentImpl)document).clearLineModificationFlagsExcept(caretLine); + List<Integer> caretLines = new ArrayList<Integer>(); + if (activeEditor != null && inChangedLinesOnly && doStrip && !isVirtualSpaceEnabled) { + List<Caret> carets = activeEditor.getCaretModel().getAllCarets(); + for (Caret caret : carets) { + caretLines.add(caret.getLogicalPosition().line); + } + } + ((DocumentImpl)document).clearLineModificationFlagsExcept(caretLines); } public static boolean stripIfNotCurrentLine(Document document, boolean inChangedLinesOnly) { @@ -157,16 +157,43 @@ public final class TrailingSpacesStripper extends FileDocumentManagerAdapter { // when virtual space enabled, we can strip whitespace anywhere boolean isVirtualSpaceEnabled = activeEditor == null || activeEditor.getSettings().isVirtualSpace(); - VisualPosition visualCaret = activeEditor == null ? null : activeEditor.getCaretModel().getVisualPosition(); - int caretLine = activeEditor == null ? -1 : activeEditor.getCaretModel().getLogicalPosition().line; - int caretOffset = activeEditor == null ? -1 : activeEditor.getCaretModel().getOffset(); + boolean markAsNeedsStrippingLater; + + if (activeEditor != null && activeEditor.getCaretModel().supportsMultipleCarets()) { + List<Caret> carets = activeEditor.getCaretModel().getAllCarets(); + List<VisualPosition> visualCarets = new ArrayList<VisualPosition>(carets.size()); + List<Integer> caretOffsets = new ArrayList<Integer>(carets.size()); + for (Caret caret : carets) { + visualCarets.add(caret.getVisualPosition()); + caretOffsets.add(caret.getOffset()); + } + + markAsNeedsStrippingLater = ((DocumentImpl)document).stripTrailingSpaces(activeEditor.getProject(), inChangedLinesOnly, isVirtualSpaceEnabled, caretOffsets); - final Project project = activeEditor == null ? null : activeEditor.getProject(); - boolean markAsNeedsStrippingLater = ((DocumentImpl)document).stripTrailingSpaces(project, inChangedLinesOnly, isVirtualSpaceEnabled, - caretLine, caretOffset); + if (!ShutDownTracker.isShutdownHookRunning()) { + final Iterator<VisualPosition> visualCaretIterator = visualCarets.iterator(); + activeEditor.getCaretModel().runForEachCaret(new CaretAction() { + @Override + public void perform(Caret caret) { + if (visualCaretIterator.hasNext()) { + caret.moveToVisualPosition(visualCaretIterator.next()); + } + } + }); + } + } + else { + VisualPosition visualCaret = activeEditor == null ? null : activeEditor.getCaretModel().getVisualPosition(); + int caretLine = activeEditor == null ? -1 : activeEditor.getCaretModel().getLogicalPosition().line; + int caretOffset = activeEditor == null ? -1 : activeEditor.getCaretModel().getOffset(); + + final Project project = activeEditor == null ? null : activeEditor.getProject(); + markAsNeedsStrippingLater = ((DocumentImpl)document).stripTrailingSpaces(project, inChangedLinesOnly, isVirtualSpaceEnabled, + caretLine, caretOffset); - if (!ShutDownTracker.isShutdownHookRunning() && activeEditor != null) { - activeEditor.getCaretModel().moveToVisualPosition(visualCaret); + if (!ShutDownTracker.isShutdownHookRunning() && activeEditor != null) { + activeEditor.getCaretModel().moveToVisualPosition(visualCaret); + } } return !markAsNeedsStrippingLater; } diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java index 46a55ea80a93..1ffd02740387 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/text/TextEditorComponent.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. @@ -343,7 +343,7 @@ class TextEditorComponent extends JBLoadingPanel implements DataProvider { */ private final class MyVirtualFileListener extends VirtualFileAdapter{ @Override - public void propertyChanged(final VirtualFilePropertyEvent e) { + public void propertyChanged(@NotNull final VirtualFilePropertyEvent e) { if(VirtualFile.PROP_NAME.equals(e.getPropertyName())){ // File can be invalidated after file changes name (extension also // can changes). The editor should be removed if it's invalid. @@ -355,7 +355,7 @@ class TextEditorComponent extends JBLoadingPanel implements DataProvider { } @Override - public void contentsChanged(VirtualFileEvent event){ + public void contentsChanged(@NotNull VirtualFileEvent event){ if (event.isFromSave()){ // commit assertThread(); VirtualFile file = event.getFile(); 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 e07a85cfbc38..4514ee8fbe58 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 @@ -252,7 +252,7 @@ public class TextEditorProvider implements FileEditorProvider, DumbAware { positions.add(new LogicalPosition(caretState.LINE, caretState.COLUMN)); selections.add(new TextRange(caretState.SELECTION_START, caretState.SELECTION_END)); } - caretModel.setCarets(positions, selections); + caretModel.setCaretsAndSelections(positions, selections); } else { LogicalPosition pos = new LogicalPosition(state.CARETS[0].LINE, state.CARETS[0].COLUMN); editor.getCaretModel().moveToLogicalPosition(pos); 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 3e21d9c3e38a..037029de3768 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 @@ -325,7 +325,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME } //noinspection ForLoopReplaceableByForEach - for (int i = 0, size = mySpecialFileTypes.size(); i < size; i++) { + for (int i = 0; i < mySpecialFileTypes.size(); i++) { FileTypeIdentifiableByVirtualFile type = mySpecialFileTypes.get(i); if (type.isMyFileType(file)) { return type; @@ -335,28 +335,35 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME fileType = getFileTypeByFileName(file.getName()); if (fileType != UnknownFileType.INSTANCE) return fileType; - fileType = file.getUserData(DETECTED_FROM_CONTENT_FILE_TYPE_KEY); + fileType = cachedDetectedFromContent(file); if (fileType != null) return fileType; return UnknownFileType.INSTANCE; } + private static FileType cachedDetectedFromContent(@NotNull VirtualFile file) { + return file.getUserData(DETECTED_FROM_CONTENT_FILE_TYPE_KEY); + } + @NotNull @Override public FileType detectFileTypeFromContent(@NotNull VirtualFile file) { if (file.isDirectory() || !file.isValid() || file.is(VFileProperty.SPECIAL)) { return UnknownFileType.INSTANCE; } - FileType fileType = file.getUserData(DETECTED_FROM_CONTENT_FILE_TYPE_KEY); + FileType fileType = cachedDetectedFromContent(file); if (fileType == null) { fileType = detectFromContent(file); - file.putUserData(DETECTED_FROM_CONTENT_FILE_TYPE_KEY, fileType); + // for empty file there is still hope its type will change + if (file.getLength() != 0) { + file.putUserData(DETECTED_FROM_CONTENT_FILE_TYPE_KEY, fileType); + } } return fileType; } public static boolean isFileTypeDetectedFromContent(@NotNull VirtualFile file) { - return file.getUserData(DETECTED_FROM_CONTENT_FILE_TYPE_KEY) != null; + return cachedDetectedFromContent(file) != null; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/keymap/impl/GenericKeymapManager.java b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/GenericKeymapManager.java new file mode 100644 index 000000000000..0b4f8d54760d --- /dev/null +++ b/platform/platform-impl/src/com/intellij/openapi/keymap/impl/GenericKeymapManager.java @@ -0,0 +1,38 @@ +package com.intellij.openapi.keymap.impl; + +import com.intellij.openapi.keymap.KeymapManager; +import com.intellij.openapi.util.SystemInfo; + +public class GenericKeymapManager extends DefaultKeymap { + @Override + public String getDefaultKeymapName() { + if (SystemInfo.isMac) { + return "Mac OS X 10.5+"; + } + else if (SystemInfo.isXWindow) { + return KeymapManager.X_WINDOW_KEYMAP; + } + else { + return KeymapManager.DEFAULT_IDEA_KEYMAP; + } + } + + @Override + public String getKeymapPresentableName(KeymapImpl keymap) { + final String name = keymap.getName(); + + if (getDefaultKeymapName().equals(name)) { + return "Default"; + } + + if (KeymapManager.DEFAULT_IDEA_KEYMAP.equals(name)) { + return "IntelliJ IDEA Classic"; + } + + if ("Mac OS X".equals(name)) { + return "IntelliJ IDEA Classic (OS X)"; + } + + return name; + } +} diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java index 92d7d874e61c..ecff0b34e668 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.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. @@ -152,12 +152,12 @@ public class SchemesManagerImpl<T extends Scheme, E extends ExternalizableScheme system.addVirtualFileListener(new VirtualFileAdapter() { @Override - public void contentsChanged(final VirtualFileEvent event) { + public void contentsChanged(@NotNull final VirtualFileEvent event) { onFileContentChanged(event); } @Override - public void fileCreated(final VirtualFileEvent event) { + public void fileCreated(@NotNull final VirtualFileEvent event) { VirtualFile file = event.getFile(); if (event.getRequestor() == null && isFileUnder(file, myVFSBaseDir) && !myInsideSave) { @@ -173,7 +173,7 @@ public class SchemesManagerImpl<T extends Scheme, E extends ExternalizableScheme } @Override - public void fileDeleted(final VirtualFileEvent event) { + public void fileDeleted(@NotNull final VirtualFileEvent event) { VirtualFile parent = event.getParent(); if (event.getRequestor() == null && parent != null && parent.equals(myVFSBaseDir) && !myInsideSave) { diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/DefaultProject.java b/platform/platform-impl/src/com/intellij/openapi/project/impl/DefaultProject.java index ada78025bd3e..5751e4a1d28b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/DefaultProject.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/DefaultProject.java @@ -15,6 +15,8 @@ */ package com.intellij.openapi.project.impl; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.ProjectManager; import org.jetbrains.annotations.NotNull; @@ -32,4 +34,13 @@ public class DefaultProject extends ProjectImpl { public boolean isDefault() { return true; } + + @Override + public synchronized void dispose() { + if (!ApplicationManager.getApplication().isDisposeInProgress() && !ApplicationManager.getApplication().isUnitTestMode()) { + Logger.getInstance(DefaultProject.class).error(new Exception("Too young to die")); + } + + super.dispose(); + } } diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java index 609e239c15e4..7de5fc0d30e0 100644 --- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java +++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 @@ public class PlaybackRunner { myUseDirectActionCall = useDirectActionCall; myUseTypingTargets = useTypingTargets; myStopOnAppDeactivation = stopOnAppDeactivation; - myAppListener = new ApplicationActivationListener() { - @Override - public void applicationActivated(IdeFrame ideFrame) { - } - + myAppListener = new ApplicationActivationListener.Adapter() { @Override public void applicationDeactivated(IdeFrame ideFrame) { if (myStopOnAppDeactivation) { 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 034fd0e849c8..aa7b6b3874e7 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 @@ -28,12 +28,11 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.PluginId; import com.intellij.openapi.fileTypes.FileTypeFactory; import com.intellij.openapi.options.ShowSettingsUtil; -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.startup.StartupActivity; -import com.intellij.openapi.updateSettings.impl.*; +import com.intellij.openapi.updateSettings.impl.PluginDownloader; +import com.intellij.openapi.updateSettings.impl.UpdateSettings; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.JDOMUtil; import com.intellij.openapi.util.io.FileUtil; @@ -134,6 +133,8 @@ public class PluginsAdvertiser implements StartupActivity { if (loadedPlugin != null && fromServerPluginDescription != null && StringUtil.compareVersionNumbers(loadedPlugin.getVersion(), fromServerPluginDescription.getVersion()) >= 0) continue; + if (fromServerPluginDescription != null && PluginManagerCore.isBrokenPlugin(fromServerPluginDescription)) continue; + final JsonElement ext = jsonObject.get("implementationName"); final String extension = StringUtil.unquoteString(ext.toString()); Set<Plugin> pluginIds = result.get(extension); diff --git a/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java index 29a1ab9c5d7c..c3d1ab0c66ec 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.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. @@ -80,11 +80,13 @@ public class FileStatusManagerImpl extends FileStatusManager implements ProjectC throw new AssertionError("Should not be called"); } + @NotNull @Override public ColorKey getColorKey() { throw new AssertionError("Should not be called"); } + @NotNull @Override public String getId() { throw new AssertionError("Should not be called"); @@ -175,7 +177,7 @@ public class FileStatusManagerImpl extends FileStatusManager implements ProjectC } @Override - public void addFileStatusListener(final FileStatusListener listener, Disposable parentDisposable) { + public void addFileStatusListener(@NotNull final FileStatusListener listener, @NotNull Disposable parentDisposable) { addFileStatusListener(listener); Disposer.register(parentDisposable, new Disposable() { @Override @@ -275,14 +277,14 @@ public class FileStatusManagerImpl extends FileStatusManager implements ProjectC } @Override - public void removeFileStatusListener(FileStatusListener listener) { + public void removeFileStatusListener(@NotNull FileStatusListener listener) { myListeners.remove(listener); } @Override - public Color getNotChangedDirectoryColor(VirtualFile vf) { + public Color getNotChangedDirectoryColor(@NotNull VirtualFile vf) { final Color notChangedColor = FileStatus.NOT_CHANGED.getColor(); - if (vf == null || !vf.isDirectory()) { + if (!vf.isDirectory()) { return notChangedColor; } final Boolean exactMatch = myWhetherExactlyParentToChanged.get(vf); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/VirtualFileUrlChangeAdapter.java b/platform/platform-impl/src/com/intellij/openapi/vfs/VirtualFileUrlChangeAdapter.java index 8cd60eff9722..9ed65306441e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/VirtualFileUrlChangeAdapter.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/VirtualFileUrlChangeAdapter.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. @@ -15,12 +15,14 @@ */ package com.intellij.openapi.vfs; +import org.jetbrains.annotations.NotNull; + /** * @author nik */ public abstract class VirtualFileUrlChangeAdapter extends VirtualFileAdapter { @Override - public void fileMoved(VirtualFileMoveEvent event) { + public void fileMoved(@NotNull VirtualFileMoveEvent event) { String oldUrl = event.getOldParent().getUrl() + "/" + event.getFileName(); String newUrl = event.getNewParent().getUrl() + "/" + event.getFileName(); fileUrlChanged(oldUrl, newUrl); @@ -29,7 +31,7 @@ public abstract class VirtualFileUrlChangeAdapter extends VirtualFileAdapter { protected abstract void fileUrlChanged(String oldUrl, String newUrl); @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { if (VirtualFile.PROP_NAME.equals(event.getPropertyName())) { final VirtualFile parent = event.getFile().getParent(); if (parent != null) { diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/ex/temp/TempFileSystem.java b/platform/platform-impl/src/com/intellij/openapi/vfs/ex/temp/TempFileSystem.java index 8744cd293dee..5840c4ea5bf6 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/ex/temp/TempFileSystem.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/ex/temp/TempFileSystem.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,11 +56,6 @@ public class TempFileSystem extends LocalFileSystemBase { return "/"; } - @Override - public int getRank() { - return 1; - } - @Nullable private FSItem convert(VirtualFile file) { final VirtualFile parentFile = file.getParent(); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java index 3c354bc30fe2..110d71003867 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/http/VirtualFileImpl.java @@ -141,10 +141,7 @@ class VirtualFileImpl extends HttpVirtualFile { @Override public VirtualFile[] getChildren() { - if (myFileInfo == null) { - return EMPTY_ARRAY; - } - throw new UnsupportedOperationException(); + return EMPTY_ARRAY; } @Override diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java index 03b63092d597..aa4e2571838c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/PersistentFSImpl.java @@ -1299,10 +1299,12 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone private static class JarRoot extends AbstractRoot { private final VirtualFile myParentLocalFile; + private final String myParentPath; private JarRoot(@NotNull NewVirtualFileSystem fs, int rootId, @NotNull VirtualFile parentLocalFile) { super(fs, rootId); myParentLocalFile = parentLocalFile; + myParentPath = myParentLocalFile.getPath(); } @NotNull @@ -1313,9 +1315,8 @@ public class PersistentFSImpl extends PersistentFS implements ApplicationCompone @Override protected char[] appendPathOnFileSystem(int accumulatedPathLength, int[] positionRef) { - String parentPath = myParentLocalFile.getPath(); - char[] chars = new char[parentPath.length() + JarFileSystem.JAR_SEPARATOR.length() + accumulatedPathLength]; - positionRef[0] = copyString(chars, positionRef[0], myParentLocalFile.getPath()); + char[] chars = new char[myParentPath.length() + JarFileSystem.JAR_SEPARATOR.length() + accumulatedPathLength]; + positionRef[0] = copyString(chars, positionRef[0], myParentPath); positionRef[0] = copyString(chars, positionRef[0], JarFileSystem.JAR_SEPARATOR); return chars; } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/tracker/VirtualFileTrackerImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/tracker/VirtualFileTrackerImpl.java index b82f2cf80c52..afdf6b8f194b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/tracker/VirtualFileTrackerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/tracker/VirtualFileTrackerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +38,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { public VirtualFileTrackerImpl(VirtualFileManager virtualFileManager) { virtualFileManager.addVirtualFileListener(new VirtualFileListener() { @Override - public void propertyChanged(final VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull final VirtualFilePropertyEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -48,7 +48,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void contentsChanged(final VirtualFileEvent event) { + public void contentsChanged(@NotNull final VirtualFileEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -58,7 +58,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void fileCreated(final VirtualFileEvent event) { + public void fileCreated(@NotNull final VirtualFileEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -68,7 +68,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void fileDeleted(final VirtualFileEvent event) { + public void fileDeleted(@NotNull final VirtualFileEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -78,7 +78,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void fileMoved(final VirtualFileMoveEvent event) { + public void fileMoved(@NotNull final VirtualFileMoveEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -88,7 +88,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void fileCopied(final VirtualFileCopyEvent event) { + public void fileCopied(@NotNull final VirtualFileCopyEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -98,7 +98,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void beforePropertyChange(final VirtualFilePropertyEvent event) { + public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -108,7 +108,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void beforeContentsChange(final VirtualFileEvent event) { + public void beforeContentsChange(@NotNull final VirtualFileEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -118,7 +118,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void beforeFileDeletion(final VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull final VirtualFileEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; @@ -128,7 +128,7 @@ public class VirtualFileTrackerImpl implements VirtualFileTracker { } @Override - public void beforeFileMovement(final VirtualFileMoveEvent event) { + public void beforeFileMovement(@NotNull final VirtualFileMoveEvent event) { final Collection<VirtualFileListener> listeners = getListeners(event.getFile(), event.isFromRefresh()); if (listeners == null) return; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java index 952bb259a605..340ca8032263 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -85,6 +85,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { return false; } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { return new ActionCallback.Done(); @@ -265,6 +266,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx { private final List<Content> myContents = new ArrayList<Content>(); private Content mySelected; + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { return new ActionCallback.Done(); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java index cc9180e4c96e..ce09b94cc7fe 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,6 +154,7 @@ public final class ToolWindowImpl implements ToolWindowEx { return myToolWindowManager.isToolWindowActive(myId) || myDecorator != null && myDecorator.isFocused(); } + @NotNull @Override public ActionCallback getReady(@NotNull final Object requestor) { final ActionCallback result = new ActionCallback(); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java index 62c0355255a4..6ab762e0904b 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/EncodingPanel.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. @@ -157,7 +157,7 @@ public class EncodingPanel extends EditorBasedWidget implements StatusBarWidget. }, this); ApplicationManager.getApplication().getMessageBus().connect(this).subscribe(VirtualFileManager.VFS_CHANGES, new BulkVirtualFileListenerAdapter(new VirtualFileAdapter() { @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { if (VirtualFile.PROP_ENCODING.equals(event.getPropertyName())) { updateForFile(event.getFile()); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java index 80aa74b1ce47..26220fb464d7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java @@ -16,14 +16,12 @@ package com.intellij.openapi.wm.impl.status; import com.intellij.concurrency.JobScheduler; -import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.wm.CustomStatusBarWidget; import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.StatusBarWidget; import com.intellij.ui.Gray; import com.intellij.ui.JBColor; import com.intellij.ui.UIBundle; -import com.intellij.util.SystemProperties; import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -39,10 +37,6 @@ import java.util.concurrent.TimeUnit; public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget { @NonNls public static final String WIDGET_ID = "Memory"; - - // todo: drop unless J. will insist to keep old style look - private static final boolean FRAMED_STYLE = SystemInfo.isMac || !SystemProperties.getBooleanProperty("idea.ui.old.mem.use", false); - private static final int MEGABYTE = 1024 * 1024; @NonNls private static final String SAMPLE_STRING; @@ -113,8 +107,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget { } private static Font getWidgetFont() { - final Font font = UIUtil.getLabelFont(); - return FRAMED_STYLE ? font.deriveFont(11.0f) : font; + return UIUtil.getLabelFont().deriveFont(11.0f); } @Override @@ -130,7 +123,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget { if (myBufferedImage == null || stateChanged) { final Dimension size = getSize(); - final Insets insets = FRAMED_STYLE ? getInsets() : new Insets(0, 0, 0, 0); + final Insets insets = getInsets(); myBufferedImage = UIUtil.createImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB); final Graphics2D g2 = (Graphics2D)myBufferedImage.getGraphics().create(); @@ -144,7 +137,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget { final int totalBarLength = size.width - insets.left - insets.right; final int usedBarLength = (int)(totalBarLength * usedMem / maxMem); final int unusedBarLength = (int)(totalBarLength * unusedMem / maxMem); - final int barHeight = FRAMED_STYLE ? HEIGHT : size.height; + final int barHeight = HEIGHT; final int yOffset = (size.height - barHeight) / 2; final int xOffset = insets.left; @@ -170,7 +163,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget { } // frame - if (FRAMED_STYLE && !UIUtil.isUnderDarcula()) { + if (!UIUtil.isUnderDarcula()) { g2.setColor(USED_COLOR_2); g2.drawRect(xOffset, yOffset, totalBarLength - 1, barHeight - 1); } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java index a55478e3eb50..d0e7e97902f2 100644 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteCredentialsHolder.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.Nullable; /** * @author michael.golubev */ -public class RemoteCredentialsHolder implements RemoteCredentials { +public class RemoteCredentialsHolder implements MutableRemoteCredentials { public static final String HOST = "HOST"; public static final String PORT = "PORT"; @@ -203,4 +203,17 @@ public class RemoteCredentialsHolder implements RemoteCredentials { myStorePassphrase = false; } } + + public void copyTo(RemoteSdkCredentials to) { + to.setHost(getHost()); + to.setPort(getPort()); + to.setAnonymous(isAnonymous()); + to.setUserName(getUserName()); + to.setPassword(getPassword()); + to.setUseKeyPair(isUseKeyPair()); + to.setPrivateKeyFile(getPrivateKeyFile()); + to.setKnownHostsFile(getKnownHostsFile()); + to.setStorePassword(isStorePassword()); + to.setStorePassphrase(isStorePassphrase()); + } } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java index 0c3392420346..51896dbf1213 100644 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteFile.java @@ -70,7 +70,7 @@ public class RemoteFile { } public static boolean isWindowsPath(@NotNull String path) { - path = RemoteSdkDataHolder.getInterpreterPathFromFullPath(path); + path = RemoteSdkCredentialsHolder.getInterpreterPathFromFullPath(path); return (path.length() > 1 && path.charAt(1) == ':'); } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java index 6aa77e639ea1..0a31e6578cce 100644 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteInterpreterException.java @@ -42,4 +42,8 @@ public class RemoteInterpreterException extends ExecutionException { return super.getMessage(); } } + + public static RemoteInterpreterException cantObtainRemoteCredentials(Throwable e) { + return new RemoteInterpreterException("Cant obtain remote credentials", e); + } } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java index 59247ec27fdc..d9f1b67bb836 100644 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkAdditionalData.java @@ -5,6 +5,6 @@ import com.intellij.openapi.projectRoots.SdkAdditionalData; /** * @author traff */ -public interface RemoteSdkAdditionalData extends RemoteSdkData, SdkAdditionalData { +public interface RemoteSdkAdditionalData extends RemoteSdkCredentials, SdkAdditionalData { void completeInitialization(); } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentials.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentials.java new file mode 100644 index 000000000000..11f14f05119d --- /dev/null +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentials.java @@ -0,0 +1,7 @@ +package com.intellij.remotesdk; + +/** + * @author traff + */ +public interface RemoteSdkCredentials extends MutableRemoteCredentials, RemoteSdkProperties { +} diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataBuilder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentialsBuilder.java index c1e9a822a062..57ea1136527b 100644 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataBuilder.java +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentialsBuilder.java @@ -21,15 +21,15 @@ import org.jetbrains.annotations.Nullable; /** * @author traff */ -public class RemoteSdkDataBuilder { +public class RemoteSdkCredentialsBuilder { private String myInterpreterPath = null; private String myHelpersPath = null; private RemoteCredentials myRemoteCredentials = null; private String myHelpersDefaultDirName = ".idea_helpers"; - public RemoteSdkData build() { - RemoteSdkData result = new RemoteSdkDataHolder(myHelpersDefaultDirName); + public RemoteSdkCredentials build() { + RemoteSdkCredentials result = new RemoteSdkCredentialsHolder(myHelpersDefaultDirName); if (myRemoteCredentials != null) { copyCredentials(myRemoteCredentials, result); @@ -47,7 +47,7 @@ public class RemoteSdkDataBuilder { } - public static void copyRemoteSdkData(@NotNull RemoteSdkData data, @NotNull RemoteSdkData copyTo) { + public static void copyRemoteSdkCredentials(@NotNull RemoteSdkCredentials data, @NotNull RemoteSdkCredentials copyTo) { copyCredentials(data, copyTo); copyTo.setInterpreterPath(data.getInterpreterPath()); @@ -72,12 +72,12 @@ public class RemoteSdkDataBuilder { copyTo.setStorePassphrase(data.isStorePassphrase()); } - public RemoteSdkDataBuilder withCredentials(@Nullable RemoteCredentials remoteCredentials) { + public RemoteSdkCredentialsBuilder withCredentials(@Nullable RemoteCredentials remoteCredentials) { myRemoteCredentials = remoteCredentials; return this; } - public RemoteSdkDataBuilder withInterpreterPath(String interpreterPath) { + public RemoteSdkCredentialsBuilder withInterpreterPath(String interpreterPath) { myInterpreterPath = interpreterPath; return this; } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataHolder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentialsHolder.java index 1cb2cb2ef460..88663598f9c6 100644 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkDataHolder.java +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkCredentialsHolder.java @@ -5,15 +5,13 @@ import org.jdom.Element; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /** * @author traff */ -public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements RemoteSdkData { - +public class RemoteSdkCredentialsHolder extends RemoteCredentialsHolder implements RemoteSdkCredentials { public static final String SSH_PREFIX = "ssh://"; private static final String INTERPRETER_PATH = "INTERPRETER_PATH"; private static final String HELPERS_PATH = "HELPERS_PATH"; @@ -21,38 +19,18 @@ public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements Remo private static final String REMOTE_PATH = "REMOTE_PATH"; private static final String INITIALIZED = "INITIALIZED"; + @NotNull + private final RemoteSdkPropertiesHolder myRemoteSdkProperties; - private String myInterpreterPath; - private String myHelpersPath; - - private final String myHelpersDefaultDirName; - - private boolean myHelpersVersionChecked = false; - - private List<String> myRemoteRoots = new ArrayList<String>(); - - private boolean myInitialized; - - public RemoteSdkDataHolder(@NotNull final String defaultDirName) { - myHelpersDefaultDirName = defaultDirName; + public RemoteSdkCredentialsHolder(@NotNull final String defaultHelpersDirName) { + myRemoteSdkProperties = new RemoteSdkPropertiesHolder(defaultHelpersDirName); } - @Override - public String getInterpreterPath() { - return myInterpreterPath; - } - - @Override - public void setInterpreterPath(String interpreterPath) { - myInterpreterPath = interpreterPath; + public static String constructSshCredentialsSdkFullPath(RemoteSdkCredentials cred) { + return SSH_PREFIX + cred.getUserName() + "@" + cred.getHost() + ":" + cred.getPort() + cred.getInterpreterPath(); } - @Override - public String getFullInterpreterPath() { - return SSH_PREFIX + getUserName() + "@" + getHost() + ":" + getPort() + myInterpreterPath; - } - /** * Extracts interpreter path from full path generated by method getFullInterpreterPath * Returns fullPath as fallback @@ -79,58 +57,83 @@ public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements Remo } + @NotNull + public RemoteSdkPropertiesHolder getRemoteSdkProperties() { + return myRemoteSdkProperties; + } + + @Override + public String getInterpreterPath() { + return myRemoteSdkProperties.getInterpreterPath(); + } + + @Override + public void setInterpreterPath(String interpreterPath) { + myRemoteSdkProperties.setInterpreterPath(interpreterPath); + } + @Override public String getHelpersPath() { - return myHelpersPath; + return myRemoteSdkProperties.getHelpersPath(); } @Override public void setHelpersPath(String helpersPath) { - myHelpersPath = helpersPath; + myRemoteSdkProperties.setHelpersPath(helpersPath); } public String getDefaultHelpersName() { - return myHelpersDefaultDirName; + return myRemoteSdkProperties.getDefaultHelpersName(); } @Override public void addRemoteRoot(String remoteRoot) { - myRemoteRoots.add(remoteRoot); + myRemoteSdkProperties.addRemoteRoot(remoteRoot); } @Override public void clearRemoteRoots() { - myRemoteRoots.clear(); + myRemoteSdkProperties.clearRemoteRoots(); } @Override public List<String> getRemoteRoots() { - return myRemoteRoots; + return myRemoteSdkProperties.getRemoteRoots(); } @Override public void setRemoteRoots(List<String> remoteRoots) { - myRemoteRoots = remoteRoots; + myRemoteSdkProperties.setRemoteRoots(remoteRoots); } @Override public boolean isHelpersVersionChecked() { - return myHelpersVersionChecked; + return myRemoteSdkProperties.isHelpersVersionChecked(); } @Override public void setHelpersVersionChecked(boolean helpersVersionChecked) { - myHelpersVersionChecked = helpersVersionChecked; + myRemoteSdkProperties.setHelpersVersionChecked(helpersVersionChecked); + } + + @Override + public String getFullInterpreterPath() { + return myRemoteSdkProperties.getFullInterpreterPath(); + } + + @Override + public void setSdkId(String sdkId) { + myRemoteSdkProperties.setSdkId(sdkId); } @Override public boolean isInitialized() { - return myInitialized; + return myRemoteSdkProperties.isInitialized(); } @Override public void setInitialized(boolean initialized) { - myInitialized = initialized; + myRemoteSdkProperties.setInitialized(initialized); } public static boolean isRemoteSdk(@Nullable String path) { @@ -142,7 +145,7 @@ public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements Remo } } - public void loadRemoteSdkData(Element element) { + public void loadRemoteSdkCredentials(Element element) { setHost(element.getAttributeValue(HOST)); setPort(StringUtil.parseInt(element.getAttributeValue(PORT), 22)); setAnonymous(StringUtil.parseBoolean(element.getAttributeValue(ANONYMOUS), false)); @@ -201,16 +204,14 @@ public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements Remo if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; - RemoteSdkDataHolder holder = (RemoteSdkDataHolder)o; + RemoteSdkCredentialsHolder holder = (RemoteSdkCredentialsHolder)o; if (isAnonymous() != holder.isAnonymous()) return false; - if (myHelpersVersionChecked != holder.myHelpersVersionChecked) return false; if (getPort() != holder.getPort()) return false; if (isStorePassphrase() != holder.isStorePassphrase()) return false; if (isStorePassword() != holder.isStorePassword()) return false; if (isUseKeyPair() != holder.isUseKeyPair()) return false; if (getHost() != null ? !getHost().equals(holder.getHost()) : holder.getHost() != null) return false; - if (myInterpreterPath != null ? !myInterpreterPath.equals(holder.myInterpreterPath) : holder.myInterpreterPath != null) return false; if (getKnownHostsFile() != null ? !getKnownHostsFile().equals(holder.getKnownHostsFile()) : holder.getKnownHostsFile() != null) { return false; } @@ -219,13 +220,11 @@ public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements Remo if (getPrivateKeyFile() != null ? !getPrivateKeyFile().equals(holder.getPrivateKeyFile()) : holder.getPrivateKeyFile() != null) { return false; } - if (myHelpersPath != null - ? !myHelpersPath.equals(holder.myHelpersPath) - : holder.myHelpersPath != null) { + if (getUserName() != null ? !getUserName().equals(holder.getUserName()) : holder.getUserName() != null) return false; + + if (!myRemoteSdkProperties.equals(holder.myRemoteSdkProperties)) { return false; } - if (myRemoteRoots != null ? !myRemoteRoots.equals(holder.myRemoteRoots) : holder.myRemoteRoots != null) return false; - if (getUserName() != null ? !getUserName().equals(holder.getUserName()) : holder.getUserName() != null) return false; return true; } @@ -243,24 +242,34 @@ public class RemoteSdkDataHolder extends RemoteCredentialsHolder implements Remo result = 31 * result + (getPassphrase() != null ? getPassphrase().hashCode() : 0); result = 31 * result + (isStorePassword() ? 1 : 0); result = 31 * result + (isStorePassphrase() ? 1 : 0); - result = 31 * result + (myInterpreterPath != null ? myInterpreterPath.hashCode() : 0); - result = 31 * result + (myHelpersPath != null ? myHelpersPath.hashCode() : 0); - result = 31 * result + (myHelpersVersionChecked ? 1 : 0); - result = 31 * result + (myRemoteRoots != null ? myRemoteRoots.hashCode() : 0); + result = 31 * result + myRemoteSdkProperties.hashCode(); return result; } @Override public String toString() { - final StringBuilder sb = new StringBuilder(); - sb.append("RemoteSdkDataHolder"); - sb.append("{getHost()='").append(getHost()).append('\''); - sb.append(", getPort()=").append(getPort()); - sb.append(", isAnonymous()=").append(isAnonymous()); - sb.append(", getUserName()='").append(getUserName()).append('\''); - sb.append(", myInterpreterPath='").append(myInterpreterPath).append('\''); - sb.append(", myHelpersPath='").append(myHelpersPath).append('\''); - sb.append('}'); - return sb.toString(); + return "RemoteSdkDataHolder" + + "{getHost()='" + + getHost() + + '\'' + + ", getPort()=" + + getPort() + + ", isAnonymous()=" + + isAnonymous() + + ", getUserName()='" + + getUserName() + + '\'' + + ", myInterpreterPath='" + + getInterpreterPath() + + '\'' + + ", myHelpersPath='" + + getHelpersPath() + + '\'' + + '}'; + } + + public void copyTo(RemoteSdkCredentialsHolder to) { + super.copyTo(to); + myRemoteSdkProperties.copyTo(to.getRemoteSdkProperties()); } } diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java deleted file mode 100644 index c4fea1d80c16..000000000000 --- a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkData.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.intellij.remotesdk; - -import org.jetbrains.annotations.Nullable; - -import java.util.List; - -/** - * @author traff - */ -public interface RemoteSdkData extends MutableRemoteCredentials { - String getInterpreterPath(); - - void setInterpreterPath(String interpreterPath); - - String getFullInterpreterPath(); - - String getHelpersPath(); - - void setHelpersPath(String tempFilesPath); - - String getDefaultHelpersName(); - - void addRemoteRoot(String remoteRoot); - - void clearRemoteRoots(); - - List<String> getRemoteRoots(); - - void setRemoteRoots(List<String> remoteRoots); - - boolean isHelpersVersionChecked(); - - void setHelpersVersionChecked(boolean helpersVersionChecked); - - boolean isInitialized(); - - void setInitialized(boolean initialized); -} diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkProperties.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkProperties.java new file mode 100644 index 000000000000..5e98352accf6 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkProperties.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.remotesdk; + +import java.util.List; + +/** + * @author traff + */ +public interface RemoteSdkProperties { + String getInterpreterPath(); + + void setInterpreterPath(String interpreterPath); + + String getHelpersPath(); + + void setHelpersPath(String helpersPath); + + String getDefaultHelpersName(); + + void addRemoteRoot(String remoteRoot); + + void clearRemoteRoots(); + + List<String> getRemoteRoots(); + + void setRemoteRoots(List<String> remoteRoots); + + boolean isHelpersVersionChecked(); + + void setHelpersVersionChecked(boolean helpersVersionChecked); + + String getFullInterpreterPath(); + + void setSdkId(String sdkId); + + @Deprecated + boolean isInitialized(); + + @Deprecated + void setInitialized(boolean initialized); +} diff --git a/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkPropertiesHolder.java b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkPropertiesHolder.java new file mode 100644 index 000000000000..11f350ca10c5 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/remotesdk/RemoteSdkPropertiesHolder.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 com.intellij.remotesdk; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author traff + */ +public class RemoteSdkPropertiesHolder implements RemoteSdkProperties { + private String mySdkId; + + private String myInterpreterPath; + private String myHelpersPath; + + private final String myHelpersDefaultDirName; + + private boolean myHelpersVersionChecked = false; + + private List<String> myRemoteRoots = new ArrayList<String>(); + + private boolean myInitialized = false; + + public RemoteSdkPropertiesHolder(String name) { + myHelpersDefaultDirName = name; + } + + @Override + public String getInterpreterPath() { + return myInterpreterPath; + } + + @Override + public void setInterpreterPath(String interpreterPath) { + myInterpreterPath = interpreterPath; + } + + @Override + public String getHelpersPath() { + return myHelpersPath; + } + + @Override + public void setHelpersPath(String helpersPath) { + myHelpersPath = helpersPath; + } + + public String getDefaultHelpersName() { + return myHelpersDefaultDirName; + } + + @Override + public void addRemoteRoot(String remoteRoot) { + myRemoteRoots.add(remoteRoot); + } + + @Override + public void clearRemoteRoots() { + myRemoteRoots.clear(); + } + + @Override + public List<String> getRemoteRoots() { + return myRemoteRoots; + } + + @Override + public void setRemoteRoots(List<String> remoteRoots) { + myRemoteRoots = remoteRoots; + } + + @Override + public boolean isHelpersVersionChecked() { + return myHelpersVersionChecked; + } + + @Override + public void setHelpersVersionChecked(boolean helpersVersionChecked) { + myHelpersVersionChecked = helpersVersionChecked; + } + + @Override + public String getFullInterpreterPath() { + return mySdkId; + } + + public void setSdkId(String sdkId) { + mySdkId = sdkId; + } + + @Override + public boolean isInitialized() { + return myInitialized; + } + + @Override + public void setInitialized(boolean initialized) { + myInitialized = initialized; + + } + + public void copyTo(RemoteSdkPropertiesHolder copy) { + copy.setInterpreterPath(getInterpreterPath()); + copy.setHelpersPath(getHelpersPath()); + copy.setHelpersVersionChecked(isHelpersVersionChecked()); + + copy.setRemoteRoots(getRemoteRoots()); + + copy.setInitialized(isInitialized()); + } +} diff --git a/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkAdditionalData2.java b/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkAdditionalData2.java new file mode 100644 index 000000000000..92ec30233a6c --- /dev/null +++ b/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkAdditionalData2.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.remotesdk2; + +import com.intellij.openapi.projectRoots.SdkAdditionalData; +import com.intellij.remotesdk.RemoteSdkCredentials; +import com.intellij.remotesdk.RemoteSdkCredentialsHolder; +import com.intellij.remotesdk.RemoteSdkProperties; + +/** + * @author traff + */ +public interface RemoteSdkAdditionalData2<T extends RemoteSdkCredentials> + extends SdkAdditionalData, RemoteSdkProducer<T>, RemoteSdkProperties { + void completeInitialization(); + + boolean isInitialized(); + + void setInitialized(boolean initialized); + + String getFullInterpreterPath(); + + /** + * This method switches to use of ssh-credentials based data + * @param credentials credentials that specify connection + */ + void setSshCredentials(RemoteSdkCredentialsHolder credentials); +} diff --git a/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkFactory2.java b/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkFactory2.java new file mode 100644 index 000000000000..cc3d06af7770 --- /dev/null +++ b/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkFactory2.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.remotesdk2; + +import com.intellij.openapi.project.Project; +import com.intellij.openapi.projectRoots.Sdk; +import com.intellij.remotesdk.RemoteInterpreterException; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.awt.*; +import java.util.Collection; + +/** + * @author traff + */ +public interface RemoteSdkFactory2<T extends RemoteSdkAdditionalData2> { + Sdk createRemoteSdk(@Nullable Project project, @NotNull T data, @Nullable String sdkName, Collection<Sdk> existingSdks) + throws RemoteInterpreterException; + + Sdk createUnfinished(T data, Collection<Sdk> existingSdks); + + String getDefaultUnfinishedName(); + + @NotNull + String sdkName(); + + boolean canSaveUnfinished(); + + void initSdk(@NotNull Sdk sdk, @Nullable Project project, @Nullable Component ownerComponent); +} diff --git a/platform/platform-impl/src/com/intellij/ui/MacNotifications.java b/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkProducer.java index d8c4711e4f25..72c585b642cd 100644 --- a/platform/platform-impl/src/com/intellij/ui/MacNotifications.java +++ b/platform/platform-impl/src/com/intellij/remotesdk2/RemoteSdkProducer.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. @@ -13,15 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.ui; +package com.intellij.remotesdk2; -import org.jetbrains.annotations.NotNull; - -import java.util.Set; +import com.intellij.remotesdk.RemoteSdkCredentials; +import com.intellij.util.Consumer; /** - * @author Dennis.Ushakov + * @author traff */ -public interface MacNotifications { - void notify(Set<String> allNotifications, @NotNull String notificationName, String title, String description); +public interface RemoteSdkProducer<T extends RemoteSdkCredentials> { + T getRemoteSdkCredentials() throws InterruptedException; + + void produceRemoteSdkCredentials(Consumer<T> remoteSdkConsumer); + + Object getRemoteSdkDataKey(); } diff --git a/platform/platform-impl/src/com/intellij/ui/AppIcon.java b/platform/platform-impl/src/com/intellij/ui/AppIcon.java index 4dba3bebacb3..f8b4b062dbe1 100644 --- a/platform/platform-impl/src/com/intellij/ui/AppIcon.java +++ b/platform/platform-impl/src/com/intellij/ui/AppIcon.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. @@ -143,22 +143,18 @@ public abstract class AppIcon { Application app = ApplicationManager.getApplication(); if (app != null && myAppListener == null) { - myAppListener = new ApplicationActivationListener() { + myAppListener = new ApplicationActivationListener.Adapter() { @Override public void applicationActivated(IdeFrame ideFrame) { hideProgress(ideFrame.getProject(), myCurrentProcessId); _setOkBadge(ideFrame, false); _setTextBadge(ideFrame, null); } - - @Override - public void applicationDeactivated(IdeFrame ideFrame) { - } }; app.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC, myAppListener); } - return app != null ? app.isActive() : false; + return app != null && app.isActive(); } } diff --git a/platform/platform-impl/src/com/intellij/ui/ComboboxEditorTextField.java b/platform/platform-impl/src/com/intellij/ui/ComboboxEditorTextField.java index ec53597b0a31..f1949805d2a8 100644 --- a/platform/platform-impl/src/com/intellij/ui/ComboboxEditorTextField.java +++ b/platform/platform-impl/src/com/intellij/ui/ComboboxEditorTextField.java @@ -78,6 +78,7 @@ public class ComboboxEditorTextField extends EditorTextField { UIUtil.setComboBoxEditorBounds(x, y, width, height, this); } + @Override protected void updateBorder(@NotNull final EditorEx editor) { if (UIUtil.isUnderAquaLookAndFeel()) { editor.setBorder(isEnabled() ? EDITOR_TEXTFIELD_BORDER : EDITOR_TEXTFIELD_DISABLED_BORDER); diff --git a/platform/platform-impl/src/com/intellij/ui/GrowlNotifications.java b/platform/platform-impl/src/com/intellij/ui/GrowlNotifications.java index 9c681bcaf55e..b5c298a3787a 100644 --- a/platform/platform-impl/src/com/intellij/ui/GrowlNotifications.java +++ b/platform/platform-impl/src/com/intellij/ui/GrowlNotifications.java @@ -27,56 +27,45 @@ import java.util.TreeSet; /** * @author mike */ -class GrowlNotifications implements MacNotifications { +class GrowlNotifications implements SystemNotificationsImpl.Notifier { private static final Logger LOG = Logger.getInstance("#com.intellij.ui.GrowlNotifications"); private static GrowlNotifications ourNotifications; - private final Set<String> myNotifications = new TreeSet<String>(); - private Growl myGrowl; - public GrowlNotifications() { - this(ApplicationNamesInfo.getInstance().getFullProductName()); - } - - GrowlNotifications(String fullProductName) { - myGrowl = new Growl(fullProductName); - register(); - } - - private String[] getAllNotifications() { - return ArrayUtil.toStringArray(myNotifications); - } - - public static synchronized GrowlNotifications getNotifications() { + public static synchronized GrowlNotifications getInstance() { if (ourNotifications == null) { ourNotifications = new GrowlNotifications(); } - return ourNotifications; } - public void notify(Set<String> allNotifications, @NotNull String notificationName, String title, String description) { - if (!myNotifications.equals(allNotifications)) { - myNotifications.addAll(allNotifications); - register(); - } + private final Growl myGrowl; + private final Set<String> myNotifications; - try { - myGrowl.notifyGrowlOf(notificationName, title, description); - } - catch (Exception e) { - LOG.error(e); - } + private GrowlNotifications() { + myGrowl = new Growl(ApplicationNamesInfo.getInstance().getFullProductName()); + myNotifications = new TreeSet<String>(); + register(); } private void register() { - myGrowl.setAllowedNotifications(getAllNotifications()); + myGrowl.setAllowedNotifications(ArrayUtil.toStringArray(myNotifications)); + myGrowl.setDefaultNotifications(ArrayUtil.toStringArray(myNotifications)); + myGrowl.register(); + } + + @Override + public void notify(@NotNull Set<String> allNames, @NotNull String name, @NotNull String title, @NotNull String description) { try { - myGrowl.setDefaultNotifications(getAllNotifications()); + if (!myNotifications.equals(allNames)) { + myNotifications.addAll(allNames); + register(); + } + + myGrowl.notifyGrowlOf(name, title, description); } catch (Exception e) { - LOG.error(e); + LOG.warn(e); } - myGrowl.register(); } } diff --git a/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java b/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java index fcc0f65e9314..6baba567bc41 100644 --- a/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java +++ b/platform/platform-impl/src/com/intellij/ui/LibNotifyWrapper.java @@ -15,53 +15,63 @@ */ package com.intellij.ui; -import com.intellij.notification.Notification; -import com.intellij.notification.NotificationGroup; -import com.intellij.notification.NotificationType; -import com.intellij.notification.Notifications; +import com.intellij.ide.AppLifecycleListener; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.ApplicationNamesInfo; import com.intellij.openapi.application.PathManager; -import com.intellij.util.lang.UrlClassLoader; +import com.intellij.util.messages.MessageBusConnection; +import com.sun.jna.Library; +import com.sun.jna.Native; +import com.sun.jna.Pointer; +import org.jetbrains.annotations.NotNull; + +import java.util.Set; /** * @author Denis Fokin */ -public class LibNotifyWrapper { - - private final static String message = "Looks like you have run 32-bit Java on a 64-bit version of OS " + - "or just have not installed appropriate libnotify.so library"; +class LibNotifyWrapper implements SystemNotificationsImpl.Notifier { + private static LibNotifyWrapper ourInstance; - private static boolean available = true; + public static synchronized LibNotifyWrapper getInstance() { + if (ourInstance == null) { + ourInstance = new LibNotifyWrapper(); + } + return ourInstance; + } - static{ - UrlClassLoader.loadPlatformLibrary("notifywrapper"); + @SuppressWarnings("SpellCheckingInspection") + private interface LibNotify extends Library { + int notify_init(String appName); + void notify_uninit(); + Pointer notify_notification_new(String summary, String body, String icon); + int notify_notification_show(Pointer notification, Pointer error); } - native private static void showNotification(final String title, final String description, final String iconPath); + private final LibNotify myLibNotify; - public static void show(final String title, final String description, final String iconPath) { - if (! available) return; - try { - showNotification(title, description, iconPath); - } catch (UnsatisfiedLinkError ule) { - available = false; - NotificationGroup.balloonGroup("Linux configuration messages"); - Notifications.Bus.notify( - new Notification("Linux configuration messages", - "Notification library has not been installed", - message, NotificationType.INFORMATION) - ); + private LibNotifyWrapper() { + myLibNotify = (LibNotify)Native.loadLibrary("notify", LibNotify.class); + + String appName = ApplicationNamesInfo.getInstance().getProductName(); + if (myLibNotify.notify_init(appName) == 0) { + throw new IllegalStateException("notify_init failed"); } - } - /** - * Shows a libnotify notification with an icon from the ide bin directory. - * If there is no such icon a default information icon is shown. - * @param title notification title - * @param description notification description - */ - public static void showWithAppIcon(final String title, final String description) { - String iconPath = AppUIUtil.findIcon(PathManager.getBinPath()); - show(title, description, (iconPath == null) ? "dialog-information" : iconPath); + MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(); + connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() { + @Override + public void appClosing() { + myLibNotify.notify_uninit(); + } + }); } + @Override + public void notify(@NotNull Set<String> allNames, @NotNull String name, @NotNull String title, @NotNull String description) { + String icon = AppUIUtil.findIcon(PathManager.getBinPath()); + if (icon == null) icon = "dialog-information"; + Pointer notification = myLibNotify.notify_notification_new(title, description, icon); + myLibNotify.notify_notification_show(notification, null); + } } diff --git a/platform/platform-impl/src/com/intellij/ui/MountainLionNotifications.java b/platform/platform-impl/src/com/intellij/ui/MountainLionNotifications.java index 20e5c1a094ba..955b38f9e340 100644 --- a/platform/platform-impl/src/com/intellij/ui/MountainLionNotifications.java +++ b/platform/platform-impl/src/com/intellij/ui/MountainLionNotifications.java @@ -33,19 +33,23 @@ import static com.intellij.ui.mac.foundation.Foundation.nsString; /** * @author Dennis.Ushakov */ -public class MountainLionNotifications implements MacNotifications { - private static MountainLionNotifications ourNotifications; +class MountainLionNotifications implements SystemNotificationsImpl.Notifier { + private static MountainLionNotifications ourInstance; - public MountainLionNotifications() { + public static synchronized MountainLionNotifications getInstance() { + if (ourInstance == null) { + ourInstance = new MountainLionNotifications(); + } + return ourInstance; + } + + private MountainLionNotifications() { final MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect(); - connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() { + connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() { @Override public void applicationActivated(IdeFrame ideFrame) { cleanupDeliveredNotifications(); } - - @Override - public void applicationDeactivated(IdeFrame ideFrame) {} }); connection.subscribe(AppLifecycleListener.TOPIC, new AppLifecycleListener.Adapter() { @Override @@ -55,24 +59,16 @@ public class MountainLionNotifications implements MacNotifications { }); } - public static synchronized MacNotifications getNotifications() { - if (ourNotifications == null) { - ourNotifications = new MountainLionNotifications(); - } - - return ourNotifications; - } - @Override - public void notify(Set<String> allNotifications, @NotNull String notificationName, String title, String description) { + public void notify(@NotNull Set<String> allNames, @NotNull String name, @NotNull String title, @NotNull String description) { final ID notification = invoke(Foundation.getObjcClass("NSUserNotification"), "new"); - invoke(notification, "setTitle:", nsString(StringUtil.stripHtml(title == null ? "" : title, true).replace("%", "%%"))); - invoke(notification, "setInformativeText:", nsString(StringUtil.stripHtml(description == null ? "" : description, true).replace("%", "%%"))); + invoke(notification, "setTitle:", nsString(StringUtil.stripHtml(title, true).replace("%", "%%"))); + invoke(notification, "setInformativeText:", nsString(StringUtil.stripHtml(description, true).replace("%", "%%"))); final ID center = invoke(Foundation.getObjcClass("NSUserNotificationCenter"), "defaultUserNotificationCenter"); invoke(center, "deliverNotification:", notification); } - public static void cleanupDeliveredNotifications() { + private static void cleanupDeliveredNotifications() { final ID center = invoke(Foundation.getObjcClass("NSUserNotificationCenter"), "defaultUserNotificationCenter"); invoke(center, "removeAllDeliveredNotifications"); } diff --git a/platform/platform-impl/src/com/intellij/ui/Splash.java b/platform/platform-impl/src/com/intellij/ui/Splash.java index 7025b4461c44..16cfa3ea377c 100644 --- a/platform/platform-impl/src/com/intellij/ui/Splash.java +++ b/platform/platform-impl/src/com/intellij/ui/Splash.java @@ -58,7 +58,9 @@ public class Splash extends JDialog implements StartupProgress { super((Frame)null, false); setUndecorated(true); - setResizable(false); + if (!(SystemInfo.isLinux && SystemInfo.isJavaVersionAtLeast("1.7"))) { + setResizable(false); + } setFocusableWindowState(false); Icon originalImage = IconLoader.getIcon(imageName); @@ -78,7 +80,12 @@ public class Splash extends JDialog implements StartupProgress { Dimension size = getPreferredSize(); setSize(size); pack(); - setLocationRelativeTo(null); + setLocationInTheCenterOfScreen(); + } + + private void setLocationInTheCenterOfScreen() { + Rectangle deviceBounds = getGraphicsConfiguration().getBounds(); + setLocation((deviceBounds.width - getWidth()) / 2, (deviceBounds.height - getHeight()) / 2); } public Splash(ApplicationInfoEx info) { diff --git a/platform/platform-impl/src/com/intellij/ui/SystemNotificationsImpl.java b/platform/platform-impl/src/com/intellij/ui/SystemNotificationsImpl.java index 3240b3eb0434..597301bb1a2d 100644 --- a/platform/platform-impl/src/com/intellij/ui/SystemNotificationsImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/SystemNotificationsImpl.java @@ -20,6 +20,7 @@ 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.diagnostic.Logger; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; import org.jetbrains.annotations.NotNull; @@ -33,65 +34,58 @@ import java.util.Set; @State( name = "SystemNotifications", storages = { - @Storage( - file = StoragePathMacros.APP_CONFIG + "/other.xml" - )} + @Storage(file = StoragePathMacros.APP_CONFIG + "/other.xml") + } ) public class SystemNotificationsImpl extends SystemNotifications implements PersistentStateComponent<SystemNotificationsImpl.State> { - private State myState = new State(); - private boolean myGrowlDisabled = false; - - public void notify(@NotNull String notificationName, @NotNull String title, @NotNull String text) { - if (!areNotificationsEnabled() || ApplicationManager.getApplication().isActive()) return; - - if (SystemInfo.isLinux && Registry.is("ide.linux.gtk.notifications.enabled") ) { - LibNotifyWrapper.showWithAppIcon(title, text); - return; - } - - final MacNotifications notifications; - try { - notifications = getMacNotifications(); - } - catch (Throwable e) { - myGrowlDisabled = true; - return; - } - - myState.NOTIFICATIONS.add(notificationName); - notifications.notify(myState.NOTIFICATIONS, notificationName, title, text); + public static class State { + public Set<String> NOTIFICATIONS = new HashSet<String>(); } - private static MacNotifications getMacNotifications() { - return SystemInfo.isMacOSMountainLion && Registry.is("ide.mac.mountain.lion.notifications.enabled") ? - MountainLionNotifications.getNotifications() : GrowlNotifications.getNotifications(); + interface Notifier { + void notify(@NotNull Set<String> allNames, @NotNull String name, @NotNull String title, @NotNull String description); } - private boolean areNotificationsEnabled() { - boolean enabled = false; - - if (SystemInfo.isMac) { - enabled = !(myGrowlDisabled || "true".equalsIgnoreCase(System.getProperty("growl.disable"))); - if (!enabled) { - enabled = SystemInfo.isMacOSMountainLion && Registry.is("ide.mac.mountain.lion.notifications.enabled"); - } - } else { - enabled = SystemInfo.isLinux && Registry.is("ide.linux.gtk.notifications.enabled"); - } - - return enabled; - } + private final Notifier myNotifier = getPlatformNotifier(); + private State myState = new State(); + @Override public State getState() { return myState; } + @Override public void loadState(final State state) { myState = state; } + @Override + public void notify(@NotNull String notificationName, @NotNull String title, @NotNull String text) { + if (myNotifier != null && !ApplicationManager.getApplication().isActive()) { + myState.NOTIFICATIONS.add(notificationName); + myNotifier.notify(myState.NOTIFICATIONS, notificationName, title, text); + } + } - public static class State { - public Set<String> NOTIFICATIONS = new HashSet<String>(); + private static Notifier getPlatformNotifier() { + try { + if (SystemInfo.isMac) { + if (SystemInfo.isMacOSMountainLion && Registry.is("ide.mac.mountain.lion.notifications.enabled")) { + return MountainLionNotifications.getInstance(); + } + if (!Boolean.getBoolean("growl.disable")) { + return GrowlNotifications.getInstance(); + } + } + + if (SystemInfo.isXWindow && Registry.is("ide.libnotify.enabled") ) { + return LibNotifyWrapper.getInstance(); + } + } + catch (Throwable t) { + Logger.getInstance(SystemNotifications.class).error(t); + } + + return null; } } diff --git a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java index b38eaedd62e7..b6e739692ede 100644 --- a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene return myComponent; } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { Content selected = getSelectedContent(); diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java b/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java index c563f9bf1a90..1e2cfd4dd9d4 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacMainFrameDecorator.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. @@ -230,7 +230,8 @@ public class MacMainFrameDecorator extends IdeFrameDecorator implements UISettin @Override public void windowEnteredFullScreen(AppEvent.FullScreenEvent event) { // We can get the notification when the frame has been disposed - if (myFrame == null/*|| ORACLE_BUG_ID_8003173*/) return; + JRootPane rootPane = frame.getRootPane(); + if (rootPane != null) rootPane.putClientProperty(FULL_SCREEN, Boolean.TRUE); enterFullscreen(); myFrame.validate(); } diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java b/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java index 1ffa4e261858..5b58847427e9 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java @@ -743,6 +743,11 @@ public class MacMessagesImpl extends MacMessages { _window = _window.getOwner(); } + if (_window != null && UIUtil.isAncestor(_window, window)) { + //if _window is an ancestor of other window it isn't foremost for sure + return null; + } + return _window; } diff --git a/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java b/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java index 8fa7a04e88c7..c338bf2bf15f 100644 --- a/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java +++ b/platform/platform-impl/src/com/intellij/ui/messages/JBMacMessages.java @@ -25,6 +25,7 @@ import com.intellij.openapi.wm.impl.ModalityHelper; import com.intellij.ui.mac.MacMessageException; import com.intellij.ui.mac.MacMessagesEmulation; import com.intellij.ui.mac.foundation.MacUtil; +import com.intellij.util.ui.UIUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,7 +50,8 @@ public class JBMacMessages extends MacMessagesEmulation { } SheetMessage sheetMessage = new SheetMessage(window, title, message, null, new String [] {defaultButton, alternateButton, otherButton}, null, defaultButton, alternateButton); - int result = sheetMessage.getResult().equals(defaultButton) ? Messages.YES : Messages.NO; + String resultString = sheetMessage.getResult(); + int result = resultString.equals(defaultButton) ? Messages.YES : resultString.equals(alternateButton) ? Messages.NO : Messages.CANCEL; if (doNotAskOption != null) { doNotAskOption.setToBeShown(sheetMessage.toBeShown(), result); } @@ -187,6 +189,6 @@ public class JBMacMessages extends MacMessagesEmulation { if (window == null) { window = getForemostWindow(null); } - new SheetMessage(window, title, message, null, new String [] {okButton}, null, null, okButton); + new SheetMessage(window, title, message, UIUtil.getErrorIcon(), new String [] {okButton}, null, null, okButton); } } diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java index 80f33f673d8a..aac44fcd37a2 100755 --- a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java +++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java @@ -18,16 +18,12 @@ package com.intellij.ui.messages; import com.intellij.icons.AllIcons; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.ui.Gray; +import com.intellij.ui.JBColor; +import com.intellij.util.ui.UIUtil; import javax.swing.*; -import javax.swing.text.SimpleAttributeSet; -import javax.swing.text.StyleConstants; -import javax.swing.text.StyledDocument; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; +import java.awt.event.*; import java.awt.geom.Area; import java.awt.geom.Rectangle2D; import java.awt.geom.RoundRectangle2D; @@ -46,18 +42,19 @@ public class SheetController { private boolean myDoNotAskResult; - private JLabel myHeaderLabel = new JLabel(); - private MultilineLabel myMessageLabel; private JButton[] buttons; private JButton myDefaultButton; private JButton myFocusedButton; - public static int SHEET_WIDTH = 400; + public int SHEET_WIDTH = 400; public int SHEET_HEIGHT = 150; + private Icon myIcon = AllIcons.Logo_welcomeScreen; + private String myResult; private JPanel mySheetPanel; private SheetMessage mySheetMessage; - private JTextArea myTextArea; + + private Dimension messageArea = new Dimension(250, Short.MAX_VALUE); SheetController(final SheetMessage sheetMessage, final String title, @@ -67,21 +64,50 @@ public class SheetController { final String defaultButtonTitle, final DialogWrapper.DoNotAskOption doNotAskOption, final String focusedButton) { + if (icon != null) { + myIcon = icon; + } myDoNotAskOption = doNotAskOption; mySheetMessage = sheetMessage; buttons = new JButton[buttonTitles.length]; - for (int i = 0; i < buttonTitles.length; i++) { - buttons[i] = new JButton(buttonTitles[i]); - if (buttonTitles[i].equals(defaultButtonTitle)) { + + myResult = null; + + for (int i = 0; i < buttons.length; i++) { + int titleIndex = buttonTitles.length - 1 - i; + String buttonTitle = buttonTitles[titleIndex]; + + buttons[i] = new JButton(); + + handleMnemonics(i, buttonTitle); + + if (buttonTitle.equals(defaultButtonTitle)) { myDefaultButton = buttons[i]; } - if (buttonTitles[i].equals(focusedButton)) { + if (buttonTitle.equals(focusedButton)) { myFocusedButton = buttons[i]; } + if (buttonTitle.equals("Cancel")) { + myResult = "Cancel"; + } + } + + if (myResult == null) { + myResult = buttonTitles[0]; } + mySheetPanel = createSheetPanel(title, message, buttons); + } + private void handleMnemonics(int i, String buttonTitle) { + buttons[i].setName(buttonTitle); + + if (buttonTitle.indexOf('&') != -1) { + buttons[i].setMnemonic(buttonTitle.charAt(buttonTitle.indexOf('&') + 1)); + buttonTitle = buttonTitle.replace("&",""); + } + buttons[i].setText(buttonTitle); } void requestFocus() { @@ -98,13 +124,16 @@ public class SheetController { @Override public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JButton) { - myResult = ((JButton)e.getSource()).getText(); + myResult = ((JButton)e.getSource()).getName(); } - mySheetMessage.startAnimation(); - + mySheetMessage.startAnimation(false); } }; + mySheetPanel.registerKeyboardAction(actionListener, + KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), + JComponent.WHEN_IN_FOCUSED_WINDOW); + for (JButton button: buttons) { button.addActionListener(actionListener); } @@ -136,52 +165,68 @@ public class SheetController { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); - AllIcons.Logo_welcomeScreen.paintIcon(this, g, 0, 0); + myIcon.paintIcon(this, g, 0, 0); } }; - myHeaderLabel = new JLabel(title); + JEditorPane headerLabel = new JEditorPane(); + + + + headerLabel.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); + headerLabel.setFont(boldFont); + headerLabel.setEditable(false); - myHeaderLabel.setFont(boldFont); + headerLabel.setContentType("text/html"); + headerLabel.setSize(250, Short.MAX_VALUE); + headerLabel.setText(title); + headerLabel.setSize(250, headerLabel.getPreferredSize().height); - myHeaderLabel.repaint(); - myHeaderLabel.setSize(myHeaderLabel.getPreferredSize()); + headerLabel.setOpaque(false); + headerLabel.setFocusable(false); - sheetPanel.add(myHeaderLabel); + sheetPanel.add(headerLabel); - myTextArea = new JTextArea(message); + headerLabel.repaint(); - myTextArea.setFont(regularFont); - myTextArea.setLineWrap(true); - myTextArea.setWrapStyleWord(true); + JEditorPane messageTextPane = new JEditorPane(); - myTextArea.setSize(250, 10); - myTextArea.setOpaque(false); + messageTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE); + messageTextPane.setFont(regularFont); + messageTextPane.setEditable(false); + messageTextPane.setContentType("text/html"); + messageTextPane.setSize(250, Short.MAX_VALUE); + messageTextPane.setText(message); + messageArea.setSize(250, messageTextPane.getPreferredSize().height); + messageTextPane.setSize(messageArea); + messageTextPane.setOpaque(false); + messageTextPane.setFocusable(false); - sheetPanel.add(myTextArea); + sheetPanel.add(messageTextPane); - myTextArea.repaint(); - myTextArea.setSize(myTextArea.getPreferredSize()); + messageTextPane.repaint(); - SHEET_HEIGHT = myTextArea.getPreferredSize().height + myHeaderLabel.getPreferredSize().height + 20 + 10 + 100; + SHEET_HEIGHT = 20 + headerLabel.getPreferredSize().height + 10 + messageArea.height + 10 + 70; sheetPanel.setSize(SHEET_WIDTH, SHEET_HEIGHT); ico.setOpaque(false); ico.setSize(new Dimension(AllIcons.Logo_welcomeScreen.getIconWidth(), AllIcons.Logo_welcomeScreen.getIconHeight())); ico.setLocation(20, 20); sheetPanel.add(ico); - myHeaderLabel.setLocation(120, 20); - myTextArea.setLocation(120, 20 + myHeaderLabel.getPreferredSize().height + 10); - layoutWithAbsoluteLayout(title, message, buttons, sheetPanel); + headerLabel.setLocation(120, 20); + messageTextPane.setLocation(120, 20 + headerLabel.getPreferredSize().height + 10); + layoutWithAbsoluteLayout(buttons, sheetPanel); + + sheetPanel.setFocusCycleRoot(true); return sheetPanel; } - private void layoutWithAbsoluteLayout(String title, String message, JButton[] buttons, JPanel sheetPanel) { + private void layoutWithAbsoluteLayout(JButton[] buttons, JPanel sheetPanel) { layoutButtons(buttons, sheetPanel); if (myDoNotAskOption != null) { @@ -190,16 +235,13 @@ public class SheetController { } } - - - private void paintShadow(Graphics2D g2d, Rectangle2D dialog) { Area shadow = new Area(new RoundRectangle2D.Double(0, 0, mySheetPanel.getBounds().width, mySheetPanel.getBounds().height, 10, 10)); g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.80f)); Color color1 = Gray._130; - Color color2 = new Color(130, 130, 130, 0); + Color color2 = new JBColor(new Color(130, 130, 130, 0), new Color(130, 130, 130, 0)); GradientPaint gp = new GradientPaint( 0, mySheetPanel.getBounds().height - 10, color1, @@ -211,13 +253,26 @@ public class SheetController { } private void layoutButtons(final JButton[] buttons, JPanel panel) { - for (int i = 0; i < buttons.length ; i ++) { - panel.add(buttons[i]); - buttons[i].repaint(); - Dimension size = buttons[i].getPreferredSize(); - buttons[i].setBounds(SHEET_WIDTH - (size.width + 10) * (buttons.length - i) - 15, SHEET_HEIGHT - 45, - size.width, size.height); + int buttonsWidth = 120; + + for (JButton button : buttons) { + panel.add(button); + button.repaint(); + buttonsWidth = button.getWidth() + 10; + } + + SHEET_WIDTH = Math.max(buttonsWidth, SHEET_WIDTH); + + int buttonShift = 15; + + for (JButton button : buttons) { + Dimension size = button.getPreferredSize(); + buttonShift += size.width; + button.setBounds(SHEET_WIDTH - buttonShift, + SHEET_HEIGHT - 45, + size.width, size.height); + buttonShift += 10; } } @@ -238,34 +293,18 @@ public class SheetController { * This method is used to show an image during message showing * @return image to show */ - private Image getStaticImage() { + Image getStaticImage() { final JFrame myOffScreenFrame = new JFrame() ; myOffScreenFrame.add(mySheetPanel); myOffScreenFrame.getRootPane().setDefaultButton(myDefaultButton); - final BufferedImage image = new BufferedImage(SHEET_WIDTH, SHEET_HEIGHT, BufferedImage.TYPE_INT_ARGB); + final BufferedImage image = UIUtil.createImage(SHEET_WIDTH, SHEET_HEIGHT, BufferedImage.TYPE_INT_ARGB); mySheetPanel.paint(image.createGraphics()); myOffScreenFrame.dispose(); return image; } - public JPanel getStaticPanel() { - final Image staticImage = getStaticImage(); - JPanel jPanel = new JPanel() { - @Override - protected void paintComponent(Graphics g) { - super.paintComponent(g); - Graphics2D g2d = (Graphics2D) g.create(); - int zeroOffset = getHeight() - SHEET_HEIGHT; - g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.95f)); - g2d.drawImage(staticImage, 0 , zeroOffset, null); - } - }; - jPanel.setOpaque(false); - return jPanel; - } - public boolean getDoNotAskResult () { return myDoNotAskResult; } @@ -274,21 +313,3 @@ public class SheetController { return myResult; } } - -class MultilineLabel extends JTextPane { - private static final long serialVersionUID = 1L; - public MultilineLabel(){ - super(); - setEditable(false); - setCursor(null); - setOpaque(false); - setFocusable(false); - - setPreferredSize(new Dimension(200,50)); - - StyledDocument doc = getStyledDocument(); - SimpleAttributeSet center = new SimpleAttributeSet(); - StyleConstants.setAlignment(center, StyleConstants.ALIGN_LEFT); - doc.setParagraphAttributes(0, doc.getLength(), center, false); - } -} 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 317313ff810c..e90078aa7a19 100755 --- a/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java +++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetMessage.java @@ -15,29 +15,31 @@ */ package com.intellij.ui.messages; +import com.apple.eawt.FullScreenUtilities; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.ui.JBColor; +import com.intellij.ui.mac.MacMainFrameDecorator; +import com.intellij.util.ui.Animator; +import com.intellij.util.ui.UIUtil; import javax.swing.*; import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.ComponentAdapter; -import java.awt.event.ComponentEvent; +import java.awt.event.*; /** * Created by Denis Fokin */ -public class SheetMessage implements ActionListener { +public class SheetMessage { private JDialog myWindow; private Window myParent; private SheetController myController; - private Timer myAnimator = new Timer(2, this); - private boolean myShouldEnlarge = true; + private final static int TIME_TO_SHOW_SHEET = 250; - private final static int SHEET_ANIMATION_STEP = 4; + private Image staticImage; + private int imageHeight; + private boolean restoreFullscreenButton; public SheetMessage(final Window owner, final String title, @@ -48,19 +50,41 @@ public class SheetMessage implements ActionListener { final String focusedButton, final String defaultButton) { - myWindow = new JDialog(owner, "This should not be shown", Dialog.ModalityType.APPLICATION_MODAL) ; + myWindow = new JDialog(owner, "This should not be shown", Dialog.ModalityType.APPLICATION_MODAL) { + @Override + public void paint(Graphics g) { + super.paint(g); + } + }; + myParent = owner; - myWindow.setSize(SheetController.SHEET_WIDTH, 0); + myWindow.setUndecorated(true); myWindow.setBackground(new JBColor(new Color(0, 0, 0, 0), new Color(0, 0, 0, 0))); myController = new SheetController(this, title, message, icon, buttons, defaultButton, doNotAskOption, focusedButton); - myWindow.setContentPane(myController.getStaticPanel()); + + + imageHeight = 0; registerMoveResizeHandler(); myWindow.setFocusableWindowState(true); myWindow.setFocusable(true); - myAnimator.start(); + startAnimation(true); + myWindow.setSize(myController.SHEET_WIDTH, myController.SHEET_HEIGHT); + restoreFullscreenButton = couldBeInFullScreen(); + if (restoreFullscreenButton) { + FullScreenUtilities.setWindowCanFullScreen(myParent, false); + } myWindow.setVisible(true); + setPositionRelativeToParent(); + } + + private boolean couldBeInFullScreen() { + if (myParent instanceof JFrame) { + JRootPane rootPane = ((JFrame)myParent).getRootPane(); + return rootPane.getClientProperty(MacMainFrameDecorator.FULL_SCREEN) == null; + } + return false; } public boolean toBeShown() { @@ -71,40 +95,65 @@ public class SheetMessage implements ActionListener { return myController.getResult(); } - void startAnimation () { - myWindow.setContentPane(myController.getStaticPanel()); - myAnimator.start(); - } + void startAnimation (final boolean enlarge) { + staticImage = myController.getStaticImage(); + JPanel staticPanel = new JPanel() { + @Override + public void paint(Graphics g) { + super.paint(g); + if (staticImage != null) { + Graphics2D g2d = (Graphics2D) g.create(); + g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.95f)); + int imageCropOffset = (UIUtil.isRetina()) ? imageHeight * 2 : imageHeight; - @Override - public void actionPerformed(ActionEvent e) { + g.drawImage(staticImage, 0,0,myController.SHEET_WIDTH,imageHeight, + 0, staticImage.getHeight(null) - imageCropOffset, + staticImage.getWidth(null) ,staticImage.getHeight(null) ,null); + } + } + }; + staticPanel.setOpaque(false); + staticPanel.setSize(myController.SHEET_WIDTH,myController.SHEET_HEIGHT); + myWindow.setContentPane(staticPanel); - int windowHeight = (myShouldEnlarge) ? myWindow.getHeight() + SHEET_ANIMATION_STEP - : myWindow.getHeight() - SHEET_ANIMATION_STEP; + Animator myAnimator = new Animator("Roll Down Sheet Animator", myController.SHEET_HEIGHT , + TIME_TO_SHOW_SHEET, false) { + @Override + public void paintNow(int frame, int totalFrames, int cycle) { + setPositionRelativeToParent(); + float percentage = (float)frame/(float)totalFrames; + imageHeight = enlarge ? (int)(((float)myController.SHEET_HEIGHT) * percentage): + (int)(myController.SHEET_HEIGHT - percentage * myController.SHEET_HEIGHT); + myWindow.repaint(); + } - myWindow.setSize(myWindow.getWidth(), windowHeight); - setPositionRelativeToParent(); - if (myWindow.getHeight() > myController.SHEET_HEIGHT) { - myAnimator.stop(); - myWindow.setContentPane( - myController.getPanel(myWindow) - ); - myController.requestFocus(); - myShouldEnlarge = false; - } + @Override + protected void paintCycleEnd() { + setPositionRelativeToParent(); + if (enlarge) { + imageHeight = myController.SHEET_HEIGHT; + staticImage = null; + myWindow.setContentPane(myController.getPanel(myWindow)); + myController.requestFocus(); + } else { + if (restoreFullscreenButton) { + FullScreenUtilities.setWindowCanFullScreen(myParent, true); + } + myWindow.dispose(); + } + } + }; + + myAnimator.resume(); - if (myWindow.getHeight() < 0) { - myAnimator.stop(); - myWindow.dispose(); - } } private void setPositionRelativeToParent () { int width = myParent.getWidth(); - myWindow.setLocation(width / 2 - SheetController.SHEET_WIDTH / 2 + myParent.getLocation().x, myParent.getInsets().top - + myParent.getLocation().y); + myWindow.setLocation(width / 2 - myController.SHEET_WIDTH / 2 + myParent.getLocation().x, + myParent.getInsets().top + myParent.getLocation().y); } private void registerMoveResizeHandler () { diff --git a/platform/platform-impl/src/org/jetbrains/ide/BuiltInServerManagerImpl.java b/platform/platform-impl/src/org/jetbrains/ide/BuiltInServerManagerImpl.java index c5609e160658..cf1104a405a2 100644 --- a/platform/platform-impl/src/org/jetbrains/ide/BuiltInServerManagerImpl.java +++ b/platform/platform-impl/src/org/jetbrains/ide/BuiltInServerManagerImpl.java @@ -20,7 +20,6 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.TestOnly; import org.jetbrains.io.BuiltInServer; -import java.util.Random; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.atomic.AtomicBoolean; @@ -40,11 +39,11 @@ public class BuiltInServerManagerImpl extends BuiltInServerManager { private BuiltInServer server; private boolean enabledInUnitTestMode = true; - static { - // IDEA-120811 - System.setProperty("io.netty.machineId", Integer.toHexString(new Random().nextInt())); - System.setProperty("io.netty.processId", "1"); - } + //static { + // // IDEA-120811 + // System.setProperty("io.netty.machineId", Integer.toHexString(new Random().nextInt())); + // System.setProperty("io.netty.processId", "1"); + //} @Override public int getPort() { diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index ac04bd213af6..8d51e6b5dbd2 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -107,6 +107,8 @@ action.EditorMoveUpAndScrollWithSelection.text=Move Up and Scroll with Selection action.EditorMoveDownAndScrollWithSelection.text=Move Down and Scroll with Selection action.EditorCloneCaretBelow.text=Clone Caret Below action.EditorCloneCaretAbove.text=Clone Caret Above +action.SelectNextOccurence.text=Select Next Occurence +action.UnselectLastOccurence.text=Unselect Last Occurence action.EditorToggleStickySelection.text=Toggle Sticky Selection action.EditorSwapSelectionBoundaries.text=Swap selection boundaries action.EditorLineStart.text=Move Caret to Line Start @@ -832,6 +834,10 @@ action.SplitVertically.text=Split _Vertically action.SplitVertically.description=Split editor area into 2 tab groups and move the current tab to the right group action.SplitHorizontally.text=Split _Horizontally action.SplitHorizontally.description=Split editor area into 2 tab groups and move the current tab to the bottom group +action.MoveTabRight.text=Move Right +action.MoveTabRight.description=Split editor area into 2 tab groups and move the current tab to the right group and close the left editor +action.MoveTabDown.text=Move Down +action.MoveTabDown.description=Split editor area into 2 tab groups and move the current tab to the bottom group and close the top editor action.ChangeSplitOrientation.text=Change Splitter O_rientation action.ChangeSplitOrientation.description=Changes orientation of splitter action.Unsplit.text=Un_split diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties index 89e0f4e99ca0..a7c02e6cba90 100644 --- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties +++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties @@ -629,4 +629,5 @@ settings.code.style.general.formatter.marker.invalid.regexp=Invalid regular expr settings.code.style.general.formatter.marker.title=Markers settings.code.style.general.formatter.marker.options.title=Options import.scheme.chooser.source=From\: -import.scheme.chooser.destination=To\:
\ No newline at end of file +import.scheme.chooser.destination=To\: +checkbox.reformat.on.typing.rbrace=Reformat block on typing '}'
\ No newline at end of file diff --git a/platform/platform-resources-en/src/messages/DiffBundle.properties b/platform/platform-resources-en/src/messages/DiffBundle.properties index e604d4fa37de..66a7bab05489 100644 --- a/platform/platform-resources-en/src/messages/DiffBundle.properties +++ b/platform/platform-resources-en/src/messages/DiffBundle.properties @@ -54,6 +54,7 @@ select.external.diff.program.dialog.title=Select External Diff Program diff.contents.are.identical.message.text=Contents are identical diff.contents.have.differences.only.in.line.separators.message.text=Contents have differences only in line separators diff.contents.have.differences.only.in.line.separators.or.whitespaces=Contents have differences only in line separators or whitespaces +show.diff.anyway.dialog.message=Show diff anyway? no.differences.dialog.title=No Differences merge.dialog.apply.change.action.name=Apply change merge.dialog.ignore.change.action.name=Ignore change @@ -62,7 +63,7 @@ merge.dialog.all.conflicts.resolved.message.text=All conflicts resolved #0 - changes count, 1 - conflicts count merge.statistics.message={0, choice, 0#No changes|1#One change|2#{0, number} changes}. {1, choice, 0#No conflicts|1#One conflict|2#{0, number} conflicts} merge.partial.diff.action.name=Compare left and right panel contents -merge.partial.diff.action.name.0.1=Compare middle and left panel contents +merge.partial.diff.action.name.0.1=Compare left and middle panel contents merge.partial.diff.action.name.1.2=Compare middle and right panel contents merge.dialog.exit.without.applying.changes.confirmation.message=Are you sure you want to exit without applying changes? cancel.visual.merge.dialog.title=Cancel Visual Merge diff --git a/platform/platform-resources-en/src/messages/FindBundle.properties b/platform/platform-resources-en/src/messages/FindBundle.properties index 20ec7830472d..26959ba14d4b 100644 --- a/platform/platform-resources-en/src/messages/FindBundle.properties +++ b/platform/platform-resources-en/src/messages/FindBundle.properties @@ -7,6 +7,7 @@ find.search.again.from.top.hotkey.message={0}, press {1} to search from the top find.search.again.from.top.action.message={0}, perform \"Find Next\" again to search from the top find.search.again.from.bottom.hotkey.message={0}, press {1} to search from the bottom find.search.again.from.bottom.action.message={0}, perform \"Find Previous\" again to search from the bottom +select.next.occurence.not.found.message=Not found, try again to search from top find.no.usages.at.cursor.error=Cannot search for usages. \nPosition to an element to find usages for, and try again. find.what.group=Find diff --git a/platform/platform-resources-en/src/messages/UIBundle.properties b/platform/platform-resources-en/src/messages/UIBundle.properties index 6999a22e254e..61d5d135cc2a 100644 --- a/platform/platform-resources-en/src/messages/UIBundle.properties +++ b/platform/platform-resources-en/src/messages/UIBundle.properties @@ -54,6 +54,7 @@ tool.window.name.dependency.viewer=Dependency Viewer tool.window.name.version.control=Version Control tool.window.name.module.dependencies=Module Dependencies tool.window.name.tasks=Time Tracking +tool.window.name.database=Database tool.window.move.to.action.group.name=Move to tool.window.move.to.top.action.name=Top tool.window.move.to.left.action.name=Left diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties index fd9d8fc883a6..b61965b67b3d 100644 --- a/platform/platform-resources-en/src/misc/registry.properties +++ b/platform/platform-resources-en/src/misc/registry.properties @@ -207,7 +207,7 @@ psi.track.invalidation=true ide.suggest.file.when.creating.filename.like.directory=true ide.suggest.file.when.creating.filename.like.directory.description=When creating a directory named foo.txt, suggest to create a file with such a name instead -find.search.in.project.files=false +find.search.in.project.files=true structureView.coalesceTime=500 @@ -224,7 +224,7 @@ ide.mac.fix.accessibleLeak=true projectView.showHierarchyErrors=true projectView.hide.dot.idea=true -show.live.templates.in.completion=false +show.live.templates.in.completion=true ide.completion.autopopup.select.live.templates=true ide.completion.autopopup.choose.by.enter=true documentation.component.editor.font=false @@ -318,8 +318,6 @@ diagrams.rendering.no.cache=true wolf.the.problem.solver=true ui.no.bangs.and.whistles=false -disable.graph.inference=false -enable.graph.inference=true comment.by.line.bulk.lines.trigger=100 @@ -356,8 +354,9 @@ bigger.font.in.project.view.description=Increases font size in Project View darcula.use.native.fonts.on.linux=true darcula.use.native.fonts.on.linux.description=If false, uses DejaVu Sans 13pt idea.4.5.laf.enabled=false -ide.linux.gtk.notifications.enabled=true -ide.linux.gtk.notifications.enabled.description=Enables GTK notifications on linux +ide.libnotify.enabled=true +# suppress inspection "UnusedProperty" +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 @@ -367,3 +366,6 @@ ide.open.file.in.temp.project.dir.description=Enables opening file in temp proje editor.allow.multiple.carets=false embed.scene.builder=false + +dsm.retina.darcula.legend=true +dsm.retina.darcula.legend.description=Experimental DSM legend component diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml index d02dd820f454..854e1ce08535 100644 --- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml +++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml @@ -54,6 +54,8 @@ serviceImplementation="com.intellij.openapi.fileEditor.impl.FileEditorProviderManagerImpl"/> <applicationService serviceInterface="com.intellij.ide.ui.search.SearchableOptionsRegistrar" serviceImplementation="com.intellij.ide.ui.search.SearchableOptionsRegistrarImpl"/> + <applicationService serviceInterface="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter" + serviceImplementation="com.intellij.openapi.fileEditor.impl.EditorEmptyTextPainter" /> <applicationService serviceImplementation="com.intellij.openapi.options.ex.IdeConfigurablesGroup"/> @@ -255,6 +257,7 @@ <statistics.usagesCollector implementation="com.intellij.internal.statistic.OsNameUsageCollector"/> <statistics.usagesCollector implementation="com.intellij.internal.statistic.OsVersionUsageCollector"/> <statistics.usagesCollector implementation="com.intellij.internal.statistic.UiInfoUsageCollector"/> + <statistics.usagesCollector implementation="com.intellij.internal.statistic.JdkInfoUsageCollector"/> <applicationConfigurable instance="com.intellij.internal.statistic.configurable.StatisticsConfigurable" id="usage.statistics" displayName="Usage Statistics"/> @@ -288,6 +291,8 @@ <fileEditorProvider implementation="com.intellij.openapi.fileEditor.impl.text.LargeFileEditorProvider"/> <frameEditorComponentProvider implementation="com.intellij.openapi.wm.ex.DefaultFrameEditorComponentProvider"/> + <lang.lineWrapStrategy language="TEXT" implementationClass="com.intellij.openapi.editor.TextLineWrapPositionStrategy"/> + <xmlRpcHandler name="fileOpener" implementation="com.intellij.ide.OpenFileXmlRpcHandler"/> <applicationService serviceInterface="org.jetbrains.ide.BuiltInServerManager" serviceImplementation="org.jetbrains.ide.BuiltInServerManagerImpl"/> diff --git a/platform/platform-resources/src/META-INF/XmlPlugin.xml b/platform/platform-resources/src/META-INF/XmlPlugin.xml index 88c3d8ba801f..761be2275b3e 100644 --- a/platform/platform-resources/src/META-INF/XmlPlugin.xml +++ b/platform/platform-resources/src/META-INF/XmlPlugin.xml @@ -440,6 +440,7 @@ <multiHostInjector implementation="com.intellij.psi.impl.source.html.HtmlConditionalCommentInjector"/> <multiHostInjector implementation="com.intellij.psi.impl.source.html.HtmlScriptLanguageInjector"/> + <html.scriptContentProvider language="HTML" implementationClass="com.intellij.psi.impl.source.html.TemplateHtmlScriptContentProvider"/> <gotoRelatedProvider implementation="com.intellij.navigation.HtmlGotoRelatedProvider"/> <xml.relatedToHtmlFilesContributor implementation="com.intellij.navigation.LinkedToHtmlFilesContributor"/> diff --git a/platform/platform-resources/src/brokenPlugins.txt b/platform/platform-resources/src/brokenPlugins.txt index a67cc57567c3..e34b74e756ab 100644 --- a/platform/platform-resources/src/brokenPlugins.txt +++ b/platform/platform-resources/src/brokenPlugins.txt @@ -2,12 +2,14 @@ // Each line contains plugin ID and list of versions that are broken. // If plugin name or version contains a space you can quote it like in command line. -NodeJS 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 -com.jetbrains.php 133.679 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12 +NodeJS 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 +com.jetbrains.php 133.982 133.679 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12 com.jetbrains.lang.ejs 131.17 131.12 com.jetbrains.twig 133.51 130.1639 -//org.jetbrains.plugins.ruby 6.0.0.20140207 +org.jetbrains.plugins.ruby 6.0.0.20140207 Pythonid 3.1 -Karma 134.686 134.31 +Karma 134.1163 134.1039 134.686 134.31 org.intellij.scala 0.32.512 org.jetbrains.kannotator 0.2.420 +SBT 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.4.0 1.5.0 +"JSTestDriver Plugin" 134.1163 134.686 134.31 134.307 134.1039
\ No newline at end of file diff --git a/platform/platform-resources/src/componentSets/Platform.xml b/platform/platform-resources/src/componentSets/Platform.xml index 77d5050c09d6..af2ede649d0b 100644 --- a/platform/platform-resources/src/componentSets/Platform.xml +++ b/platform/platform-resources/src/componentSets/Platform.xml @@ -145,6 +145,11 @@ <component> <implementation-class>com.intellij.diagnostic.DebugLogManager</implementation-class> </component> + + <component> + <interface-class>com.intellij.openapi.editor.EditorLastActionTracker</interface-class> + <implementation-class>com.intellij.openapi.editor.impl.EditorLastActionTrackerImpl</implementation-class> + </component> </application-components> <project-components> diff --git a/platform/platform-resources/src/idea/Keymap_Default.xml b/platform/platform-resources/src/idea/Keymap_Default.xml index 2e91d14985ab..447d4abfb649 100644 --- a/platform/platform-resources/src/idea/Keymap_Default.xml +++ b/platform/platform-resources/src/idea/Keymap_Default.xml @@ -112,6 +112,12 @@ <action id="FindWordAtCaret"> <keyboard-shortcut first-keystroke="control F3"/> </action> + <action id="SelectNextOccurrence"> + <keyboard-shortcut first-keystroke="alt J"/> + </action> + <action id="UnselectLastOccurrence"> + <keyboard-shortcut first-keystroke="alt shift J"/> + </action> <action id="GotoDeclaration"> <keyboard-shortcut first-keystroke="control B"/> <mouse-shortcut keystroke="ctrl button1"/> @@ -924,7 +930,7 @@ <keyboard-shortcut first-keystroke="alt shift A" /> </action> - <action id="DatabaseView.PropertiesAction"><keyboard-shortcut first-keystroke="F4"/><keyboard-shortcut first-keystroke="ENTER"/></action> + <action id="DatabaseView.PropertiesAction" /> <action id="Jdbc.OpenConsole"><keyboard-shortcut first-keystroke="control shift F10"/></action> <action id="Jpa.OpenConsole"><keyboard-shortcut first-keystroke="control shift F10"/></action> diff --git a/platform/platform-resources/src/idea/Keymap_Eclipse.xml b/platform/platform-resources/src/idea/Keymap_Eclipse.xml index ca8c81e424db..2a28414bd583 100644 --- a/platform/platform-resources/src/idea/Keymap_Eclipse.xml +++ b/platform/platform-resources/src/idea/Keymap_Eclipse.xml @@ -121,6 +121,12 @@ <action id="FindPrevious"> <keyboard-shortcut first-keystroke="shift control K" /> </action> + <action id="SelectNextOccurrence"> + <keyboard-shortcut first-keystroke="alt Y"/> + </action> + <action id="UnselectLastOccurrence"> + <keyboard-shortcut first-keystroke="alt shift Y"/> + </action> <action id="FindUsages"> <keyboard-shortcut first-keystroke="control G" /> </action> diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 3fe320b77ffc..e0e136024f2a 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -225,6 +225,8 @@ <action id="FindNext" class="com.intellij.ide.actions.SearchAgainAction"/> <action id="FindPrevious" class="com.intellij.ide.actions.SearchBackAction"/> <action id="FindWordAtCaret" class="com.intellij.openapi.editor.actions.FindWordAtCaretAction"/> + <action id="SelectNextOccurrence" class="com.intellij.openapi.editor.actions.SelectNextOccurrenceAction"/> + <action id="UnselectLastOccurrence" class="com.intellij.openapi.editor.actions.UnselectLastOccurrenceAction"/> <separator/> <action id="FindInPath" class="com.intellij.find.actions.FindInPathAction"/> <action id="ReplaceInPath" class="com.intellij.find.actions.ReplaceInPathAction"/> @@ -374,6 +376,8 @@ <action id="ReopenClosedTab" class="com.intellij.openapi.fileEditor.impl.ReopenClosedTabAction" /> <action id="SplitVertically" class="com.intellij.ide.actions.SplitVerticallyAction" icon="AllIcons.Actions.SplitVertically"/> <action id="SplitHorizontally" class="com.intellij.ide.actions.SplitHorizontallyAction" icon="AllIcons.Actions.SplitHorizontally"/> + <action id="MoveTabRight" class="com.intellij.ide.actions.MoveTabRightAction"/> + <action id="MoveTabDown" class="com.intellij.ide.actions.MoveTabDownAction"/> <action id="ChangeSplitOrientation" class="com.intellij.ide.actions.ChangeSplitterOrientationAction"/> <action id="Unsplit" class="com.intellij.ide.actions.UnsplitAction"/> <action id="UnsplitAll" class="com.intellij.ide.actions.UnsplitAllAction"/> @@ -476,6 +480,8 @@ <separator/> <reference ref="SplitVertically"/> <reference ref="SplitHorizontally"/> + <reference ref="MoveTabRight"/> + <reference ref="MoveTabDown"/> <action id="MoveEditorToOppositeTabGroup" class="com.intellij.openapi.fileEditor.impl.MoveEditorToOppositeTabGroupAction"/> <action id="OpenEditorInOppositeTabGroup" class="com.intellij.openapi.fileEditor.impl.OpenEditorInOppositeTabGroupAction"/> <reference ref="ChangeSplitOrientation"/> diff --git a/platform/platform-tests/platform-tests.iml b/platform/platform-tests/platform-tests.iml index a2fe52638ffd..d1018688da69 100644 --- a/platform/platform-tests/platform-tests.iml +++ b/platform/platform-tests/platform-tests.iml @@ -22,6 +22,7 @@ <orderEntry type="module" module-name="xml-openapi" /> <orderEntry type="library" name="Groovy" level="project" /> <orderEntry type="library" name="Netty" level="project" /> + <orderEntry type="library" name="http-client" level="project" /> </component> </module> diff --git a/platform/platform-tests/testData/certificates/ca.crt b/platform/platform-tests/testData/certificates/ca.crt new file mode 100644 index 000000000000..d258c4e4009a --- /dev/null +++ b/platform/platform-tests/testData/certificates/ca.crt @@ -0,0 +1,56 @@ +-----BEGIN CERTIFICATE----- +MIIKGTCCBgGgAwIBAgIJAMs2bK7YyVSbMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD +VQQGEwJSVTEPMA0GA1UECAwGUnVzc2lhMRYwFAYDVQQHDA1TdC5QZXRlcnNidXJn +MRswGQYDVQQKDBJDZXJ0aWZpY2F0ZXMgVGVzdHMxHjAcBgNVBAsMFUNlcnRpZmlj +YXRlIEF1dGhvcml0eTEtMCsGA1UEAwwkY2VydGlmaWNhdGVzLXRlc3RzLmxhYnMu +aW50ZWxsaWoubmV0MB4XDTE0MDIxMzE1MzkyOFoXDTI0MDIxMTE1MzkyOFowgaIx +CzAJBgNVBAYTAlJVMQ8wDQYDVQQIDAZSdXNzaWExFjAUBgNVBAcMDVN0LlBldGVy +c2J1cmcxGzAZBgNVBAoMEkNlcnRpZmljYXRlcyBUZXN0czEeMBwGA1UECwwVQ2Vy +dGlmaWNhdGUgQXV0aG9yaXR5MS0wKwYDVQQDDCRjZXJ0aWZpY2F0ZXMtdGVzdHMu +bGFicy5pbnRlbGxpai5uZXQwggQiMA0GCSqGSIb3DQEBAQUAA4IEDwAwggQKAoIE +AQCnFJ7EhraRT/sleDkR9fkHL7UT+ae3DSB5nJcc5sELv+5PirL2rYpwGtbdr4LX +bgsACCk2iRKlVdCA4RRhMBuPm7XQ88Wtj2cMV8FUcl0xrAhg27vIAViLsLNf5vFV +An+FUBfjxy++mMlYEFJXXILEE7TyfW1CHMBhn+2S0IBIvBjWDeWacvKrq/WUJ2qm +BQJrvubRL1MtXaUOt8naYgiLLZRFmcy4/id8rxA+7+nX02hckibQXPfEiEzYKB9c +zRN4fctYIAsVBY7dx6dDlysRPPzenBkd7ym3EB1ZBDobVJRb8cfct2ysl/C9B71t +FP9X7gfzSmm/vYdQw3EsIUMJQDWdiEmHAP+Bj9aOftVvi6I8OSuHr9SB7W52vgo6 +o+aYrKmCQGMs98WF8XjOsDa4T0MH4e0lUIZ5YuITlH6rG0/iM8GhuJJKaF9XJSia +Osj6YdkgUYSoK1ZYZwtLUJ30u2N7AvhQ0xRZbSjZCLFfA7eu3V9B4hBL4q+u97+M +CuqUje+KurrQKZ4XVnfiPNMjXocx3i1KULP9jW09ZAa1sGyv3sCETkP+dbbhcF5X +WA2Is+33zj452lX5PoCIkTHZtVTbixnJ64DsBX3YwfZFtwHH/wDwRWtxnwWNXGIq +sV9NpHxYc4t5G9kH4Pr9LuepEPhS0wgAyZjcwgOBece04ouSEt1o+udhdCz3GHgi +c/LukWcyyTcgm3u48sdBEfuwJQhnUmeD2JR7LtkCP7DdutoiHa64VKG80+9fcj2G +nyxATu0wnylSsEx7Iz22pY5F8wXEvKq2TlhF0vMB6QmrFQO710mXPwLc4qxfB6K7 +dk1Rs3J9pCV2+c7oEJ4sGsu2P7ZTIhJp3DdOnkv5sYfV2jBLp+YtGE6RfvGm8AaB +Rl9mL9ogNMmtn3L5B+/0geOcKbghdC6DFVhqhT1NaAndRoEjsIkqUkOKY3ivtrD9 +qbfRDfab0nJPAaICg8fK+UC8YOQnwVmKPc/Ayh+miSWdh43X6nWsJOoLLqd5ezhb +Fkub0Q0ROJo8hd+qOhB/Hl8oLW2hhsYHQ1LOdlVEBepD83z5TrulQbxEFvfb21e3 +3+d8lxlpBAnnDAs3JBoH5ZwBe2ZHWyX6ed0tYLu6px5VHC/OUYpOc4TVh2g8xWdo +CVnifVMaFIQ7Xif9cH5elQ7OEXcdBkCD4IOGZ3KnT0DwKA73xunN97yDyvu7K8aK +sj9DdfW9hQuBMVkdlKVt2100k6J+pLG9Zf2XG28V0SLQts8nf9DgtuDorhhJJVTc +BmXv4M/cxRoZhyG3BXgvKxdeK8cXmN4ihNxg/g0aEPZwg+DEVxnzXl3bG3kNkADS +6lhFD4Zqcb7cwreZJS/ZRwhZAgMBAAGjUDBOMB0GA1UdDgQWBBQFwIdyxmmbuGGG +jI/xWD7HbEbk0DAfBgNVHSMEGDAWgBQFwIdyxmmbuGGGjI/xWD7HbEbk0DAMBgNV +HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IEAQBHiCzKtExfXX/6qrpvquwEAjni +6r/m8M7C0Lu76WNRQcXWpi6tS+n43bNOx430OUXRJG2Jl4xYAqprLJv3QP8yPxof +sRhhbJutzAJr+oBdvV6xcgUJm+P8LWWE80UlPK9tP0sbNv1z/gbyJlt/H6h19FwJ +A1GR12ygeB6IIp000tsq5l9AEDwiAlSQ7cd30OVx0CfnoLiMpYNaU2eDOpA6NRNz +/wjFdbE1PRNEkDPuRHABhmDX5NeLrhg1xcRodb1b64vszcTiJJ/zOo0qIEnQursR +U+bGgcZpEhd5CUDCIs95u508LApju/pBH1BM2otU+14Y5R+8OQUC91yMB3ZxdRIr +xJFNwSSbeeKOxWIVcAtv2HmwAQItxDCAktUL3CoamB2EUNCXLSE9i/9CxxFXpRuG +EVNk0feKLXPS02AtxiyS2WkHRNRVoJnkjskHMIuwj1Cewz+SGshQAOh1g0OuWzFC +M+Wl6xV7xJJld04E+RE3FTJfz2idJmz+xc/Pg7x/RZ8W7T+Qk8P6BWJfJSOMme3I +CNAMeq1YUe//l710nuGD98mLr/X0iZwZamN363uQh+6Ist46kL3wSENME5Gx2F+N +uRwKbYZbhGbm4fRmqvF7ByyL/cAovHuEHlZVghLkx8m+dD+D3Qz2aEp6aph8eWQE +l4fDYm7v45l9MNc0EN4eSfFDqaX4c/4TSZXiWhBMrMO187TH3MziaQ5ep3o2H6He +0f3TcJdy4/wyIzYBQX8KHTpnsvwEzuXSlqOa5hv45E8NQ0eS6PcCPgHfQiMJtx7n +3eEVScB10PShiTvbkn8u8bETUyQOhP78a1E19H9sx8nANPTCzO5rQ63GF/d4AGoQ +Urh7XDAHnE358i21BKmcD4eIimaI+3qs1tTXElMf3KSrGZ5RY3u9doSTTKPBj2ef +sjhxNYICkyN0jTNnfh8q8a7BBvNUh3ywvTlYaeuFFf8OQoJjYA06ZNHe898IkHcq +JtPUaNVlc00+JhpcZFvA8FUmEFaCv3Nm2EZnS//7Fc2F/wvthhRsXM2waWLuEf6Q +yr+jfloKpG/H/xnb4OFuRQf2s2eER18wlj8hc5WfBTsJoGaOd9mVJlakKmDi6Y27 +qcbGZ6Lq2TeN+z+/QmN+obPOuopffYRnujsGbQ69yhXr3kllNs7PlSxEwf1j+j8t +GN3RdE6Hss1Bnn6kFpLDsOOJO+v0OAIsfN4sLjOHMUj5LZsFVlyBJafwTp2sFri+ +RtRGSvSUMNFeLlNgHuh4Oh9aBpOkPEMZZvU1fefBb+wNNPvWECF8KHPcgfZ+P4Bf +xSw3BPhIwP45Y2TDx3MKX8FL6jgjXZsks0M0XXMms1Lr6G+Bdp0rMfrvKptN +-----END CERTIFICATE----- diff --git a/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java b/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java new file mode 100644 index 000000000000..e1bb3f47a38b --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/concurrency/JobUtilTest.java @@ -0,0 +1,331 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.concurrency; + +import com.intellij.codeInsight.daemon.impl.DaemonProgressIndicator; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.openapi.progress.ProgressIndicator; +import com.intellij.openapi.progress.ProgressManager; +import com.intellij.openapi.progress.util.AbstractProgressIndicatorBase; +import com.intellij.openapi.progress.util.ProgressIndicatorBase; +import com.intellij.testFramework.PlatformLangTestCase; +import com.intellij.util.Processor; + +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; + +public class JobUtilTest extends PlatformLangTestCase { + private static final AtomicInteger COUNT = new AtomicInteger(); + + @Override + protected boolean isRunInWriteAction() { + return false; + } + + public void testUnbalancedTaskJobUtilPerformance() { + List<Integer> things = new ArrayList<Integer>(Collections.<Integer>nCopies(10000, null)); + int sum = 0; + for (int i = 0; i < things.size(); i++) { + int v = i < 9950 ? 1 : 1000; + things.set(i, v); + sum += things.get(i); + } + assertEquals(59950, sum); + + long start = System.currentTimeMillis(); + boolean b = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(things, new ProgressIndicatorBase(), false, false, new Processor<Integer>() { + @Override + public boolean process(Integer o) { + busySleep(o); + return true; + } + }); + assertTrue(b); + long elapsed = System.currentTimeMillis() - start; + int expected = 2 * (9950 + 50 * 1000) / JobSchedulerImpl.CORES_COUNT; + String message = "Elapsed: " + elapsed + "; expected: " + expected; + System.out.println(message); + assertTrue(message, elapsed < expected); + } + + private static int busySleep(int ms) { + long end = System.currentTimeMillis() + ms; + while (System.currentTimeMillis() < end); + return COUNT.incrementAndGet(); + } + + public void testJobUtilCorrectlySplitsUpHugeWorkAndFinishes() throws Exception { + COUNT.set(0); + int N = 100000; + List<String> list = Collections.nCopies(N, null); + final AtomicReference<Exception> exception = new AtomicReference<Exception>(); + final AtomicBoolean finished = new AtomicBoolean(); + + JobLauncher.getInstance().invokeConcurrentlyUnderProgress(list, null, false, new Processor<String>() { + @Override + public boolean process(String name) { + try { + if (finished.get()) { + throw new RuntimeException(); + } + for (int i = 0; i < 1000; i++) { + new BigDecimal(i).multiply(new BigDecimal(1)); + } + busySleep(1); + if (finished.get()) { + throw new RuntimeException(); + } + } + catch (Exception e) { + exception.set(e); + } + return true; + } + }); + finished.set(true); + Thread.sleep(1000); + if (exception.get() != null) throw exception.get(); + assertEquals(N, COUNT.get()); + } + + public void testJobUtilProcessesAllItems() throws Exception { + List<String> list = Collections.nCopies(10000, null); + final AtomicReference<Exception> exception = new AtomicReference<Exception>(); + for (int i=0; i<10; i++) { + long start = System.currentTimeMillis(); + COUNT.set(0); + JobLauncher.getInstance().invokeConcurrentlyUnderProgress(list, null, false, new Processor<String>() { + @Override + public boolean process(String name) { + busySleep(1); + return true; + } + }); + if (exception.get() != null) throw exception.get(); + long finish = System.currentTimeMillis(); + System.out.println("Elapsed: "+(finish-start)+"ms"); + assertEquals(list.size(), COUNT.get()); + } + } + + public void testJobUtilRecursive() throws Exception { + final List<String> list = Collections.nCopies(100, null); + for (int i=0; i<10; i++) { + COUNT.set(0); + long start = System.currentTimeMillis(); + JobLauncher.getInstance().invokeConcurrentlyUnderProgress(list, null, false, new Processor<String>() { + @Override + public boolean process(String name) { + JobLauncher.getInstance().invokeConcurrentlyUnderProgress(list, null, false, new Processor<String>() { + @Override + public boolean process(String name) { + busySleep(1); + return true; + } + }); + return true; + } + }); + long finish = System.currentTimeMillis(); + System.out.println("Elapsed: "+(finish-start)+"ms"); + assertEquals(list.size()*list.size(), COUNT.get()); + } + } + + public void testCorrectProgressAndReadAction() throws Throwable { + checkProgressAndReadAction(Collections.singletonList(null), new DaemonProgressIndicator(), true); + checkProgressAndReadAction(Collections.singletonList(null), new DaemonProgressIndicator(), false); + checkProgressAndReadAction(Collections.emptyList(), new DaemonProgressIndicator(), true); + checkProgressAndReadAction(Collections.emptyList(), new DaemonProgressIndicator(), false); + checkProgressAndReadAction(Arrays.asList(new Object(), new Object()), new DaemonProgressIndicator(), true); + checkProgressAndReadAction(Arrays.asList(new Object(), new Object()), new DaemonProgressIndicator(), false); + checkProgressAndReadAction(Arrays.asList(new Object(), new Object()), null, false); + } + + private static void checkProgressAndReadAction(final List<Object> objects, + final DaemonProgressIndicator progress, + final boolean runInReadAction) throws Throwable { + final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); + JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, progress, runInReadAction, new Processor<Object>() { + @Override + public boolean process(Object o) { + try { + if (objects.size() <= 1 || JobSchedulerImpl.CORES_COUNT <= JobLauncherImpl.CORES_FORK_THRESHOLD) { + assertTrue(ApplicationManager.getApplication().isDispatchThread()); + } + else { + // generally we know nothing about current thread since FJP can help others task to execute while in current context + } + ProgressIndicator actualIndicator = ProgressManager.getInstance().getProgressIndicator(); + if (progress == null) { + assertNotNull(actualIndicator); + assertTrue(actualIndicator instanceof AbstractProgressIndicatorBase); + } + else { + assertTrue(actualIndicator instanceof SensitiveProgressWrapper); + ProgressIndicator original = ((SensitiveProgressWrapper)actualIndicator).getOriginalProgressIndicator(); + assertSame(progress, original); + } + // there can be read access even if we didn't ask for it (e.g. when task under read action steals others work) + assertTrue(!runInReadAction || ApplicationManager.getApplication().isReadAccessAllowed()); + } + catch (Throwable e) { + exception.set(e); + } + return true; + } + }); + if (exception.get() != null) throw exception.get(); + } + + public void testExceptionalCompletion() throws Throwable { + final List<Object> objects = Collections.nCopies(100000000, null); + COUNT.set(0); + try { + JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, null, true, new Processor<Object>() { + @Override + public boolean process(Object o) { + if (COUNT.incrementAndGet() == 100000) { + System.out.println("PCE"); + throw new ProcessCanceledException(); + } + return true; + } + }); + fail("PCE must have been thrown"); + } + catch (ProcessCanceledException e) { + // caught OK + } + } + public void testNotNormalCompletion() throws Throwable { + final List<Object> objects = Collections.nCopies(100000000, null); + COUNT.set(0); + try { + boolean success = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, null, true, new Processor<Object>() { + @Override + public boolean process(Object o) { + if (COUNT.incrementAndGet() == 100000) { + System.out.println("PCE"); + return false; + } + return true; + } + }); + assertFalse(success); + } + catch (ProcessCanceledException e) { + } + } + + public void testJobUtilCompletesEvenIfCannotGrabReadAction() throws Throwable { + final List<Object> objects = Collections.nCopies(1000000, null); + COUNT.set(0); + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + boolean success = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(objects, null, true, false, new Processor<Object>() { + @Override + public boolean process(Object o) { + COUNT.incrementAndGet(); + return true; + } + }); + assertTrue(success); + assertEquals(objects.size(), COUNT.get()); + } + }); + } + + public void testJobUtilRecursiveCancel() throws Exception { + final List<String> list = Collections.nCopies(100, ""); + final List<Integer> ilist = Collections.nCopies(100, 0); + for (int i=0; i<10; i++) { + COUNT.set(0); + long start = System.currentTimeMillis(); + boolean success = false; + try { + success = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(list, null, false, new Processor<String>() { + @Override + public boolean process(String name) { + boolean nestedSuccess = JobLauncher.getInstance().invokeConcurrentlyUnderProgress(ilist, null, false, new Processor<Integer>() { + @Override + public boolean process(Integer integer) { + if (busySleep(1) == 1000) { + System.out.println("PCE"); + throw new RuntimeException("xxx"); + } + return true; + } + }); + //System.out.println("nestedSuccess = " + nestedSuccess); + return true; + } + }); + } + catch (ProcessCanceledException e) { + // OK + } + catch (RuntimeException e) { + assertEquals("xxx", e.getMessage()); + } + long finish = System.currentTimeMillis(); + System.out.println("Elapsed: "+(finish-start)+"ms"); + //assertEquals(list.size()*list.size(), COUNT.get()); + assertFalse(success); + } + } + + public void testSaturation() throws InterruptedException { + final CountDownLatch latch = new CountDownLatch(1); + for (int i=0; i<100; i++) { + JobLauncher.getInstance().submitToJobThread(0, new Runnable() { + @Override + public void run() { + try { + latch.await(); + } + catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + }); + } + JobLauncher.getInstance().submitToJobThread(0, new Runnable() { + @Override + public void run() { + latch.countDown(); + } + }); + + try { + boolean scheduled = latch.await(3, TimeUnit.SECONDS); + assertFalse(scheduled); // pool saturated, no thread can be scheduled + } + finally { + latch.countDown(); + } + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/ExternalChangesAndRefreshingTest.java b/platform/platform-tests/testSrc/com/intellij/history/integration/ExternalChangesAndRefreshingTest.java index 36cc5165dfe0..74cfc98bde23 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/ExternalChangesAndRefreshingTest.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/ExternalChangesAndRefreshingTest.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. @@ -21,6 +21,7 @@ import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.*; import com.intellij.util.ui.UIUtil; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; @@ -130,7 +131,7 @@ public class ExternalChangesAndRefreshingTest extends IntegrationTestCase { VirtualFileListener l = new VirtualFileAdapter() { @Override - public void fileCreated(VirtualFileEvent e) { + public void fileCreated(@NotNull VirtualFileEvent e) { executeSomeCommand(); } }; @@ -159,7 +160,7 @@ public class ExternalChangesAndRefreshingTest extends IntegrationTestCase { final String[] content = new String[1]; VirtualFileListener l = new VirtualFileAdapter() { @Override - public void fileCreated(VirtualFileEvent e) { + public void fileCreated(@NotNull VirtualFileEvent e) { try { if (!e.getFile().getPath().equals(path)) return; content[0] = new String(e.getFile().contentsToByteArray()); diff --git a/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java b/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java index 392d567377d7..d192ef3b5016 100644 --- a/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.java +++ b/platform/platform-tests/testSrc/com/intellij/history/integration/FileListeningTest.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,6 +28,7 @@ import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.*; import com.intellij.util.SmartList; import com.intellij.util.io.ReadOnlyAttributeUtil; +import org.jetbrains.annotations.NotNull; import java.io.File; import java.io.IOException; @@ -110,12 +111,12 @@ public class FileListeningTest extends IntegrationTestCase { final int[] log = new int[2]; VirtualFileListener l = new VirtualFileAdapter() { @Override - public void beforePropertyChange(VirtualFilePropertyEvent e) { + public void beforePropertyChange(@NotNull VirtualFilePropertyEvent e) { log[0] = getRevisionsFor(f).size(); } @Override - public void propertyChanged(VirtualFilePropertyEvent e) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent e) { log[1] = getRevisionsFor(f).size(); } }; diff --git a/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java b/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java new file mode 100644 index 000000000000..1d9bca4db747 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/module/ModulePointerTest.java @@ -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 com.intellij.module; + +import com.intellij.openapi.Disposable; +import com.intellij.openapi.application.Result; +import com.intellij.openapi.application.WriteAction; +import com.intellij.openapi.module.*; +import com.intellij.testFramework.PlatformLangTestCase; + +/** + * @author nik + */ +public class ModulePointerTest extends PlatformLangTestCase { + public void testCreateByName() throws Exception { + final ModulePointer pointer = getPointerManager().create("m"); + assertSame(pointer, getPointerManager().create("m")); + assertNull(pointer.getModule()); + assertEquals("m", pointer.getModuleName()); + + final Module module = addModule("m"); + + assertSame(module, pointer.getModule()); + assertEquals("m", pointer.getModuleName()); + } + + public void testCreateByModule() throws Exception { + final Module module = addModule("x"); + final ModulePointer pointer = getPointerManager().create(module); + assertSame(pointer, getPointerManager().create(module)); + assertSame(pointer, getPointerManager().create("x")); + assertSame(module, pointer.getModule()); + assertEquals("x", pointer.getModuleName()); + + ModifiableModuleModel model = getModuleManager().getModifiableModel(); + model.disposeModule(module); + commitModel(model); + + assertNull(pointer.getModule()); + assertEquals("x", pointer.getModuleName()); + + final Module newModule = addModule("x"); + assertSame(pointer, getPointerManager().create(newModule)); + } + + public void testRenameModule() throws Exception { + final ModulePointer pointer = getPointerManager().create("abc"); + final Module module = addModule("abc"); + ModifiableModuleModel model = getModuleManager().getModifiableModel(); + model.renameModule(module, "xyz"); + commitModel(model); + assertSame(module, pointer.getModule()); + assertEquals("xyz", pointer.getModuleName()); + } + + public void testDisposePointerFromUncommitedModifiableModel() throws Exception { + final ModulePointer pointer = getPointerManager().create("xxx"); + + final ModifiableModuleModel modifiableModel = getModuleManager().getModifiableModel(); + final Module module = modifiableModel.newModule(myProject.getBaseDir().getPath() + "/xxx.iml", EmptyModuleType.getInstance().getId()); + assertSame(pointer, getPointerManager().create(module)); + assertSame(pointer, getPointerManager().create("xxx")); + + assertSame(module, pointer.getModule()); + assertEquals("xxx", pointer.getModuleName()); + + modifiableModel.dispose(); + + assertNull(pointer.getModule()); + assertEquals("xxx", pointer.getModuleName()); + } + + private ModuleManager getModuleManager() { + return ModuleManager.getInstance(myProject); + } + + private Module addModule(final String name) { + final ModifiableModuleModel model = getModuleManager().getModifiableModel(); + final Module module = model.newModule(myProject.getBaseDir().getPath() + "/" + name + ".iml", EmptyModuleType.getInstance().getId()); + commitModel(model); + disposeOnTearDown(new Disposable() { + @Override + public void dispose() { + if (!module.isDisposed()) { + getModuleManager().disposeModule(module); + } + } + }); + return module; + } + + private static void commitModel(final ModifiableModuleModel model) { + new WriteAction() { + @Override + protected void run(final Result result) { + model.commit(); + } + }.execute(); + } + + private ModulePointerManager getPointerManager() { + return ModulePointerManager.getInstance(myProject); + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/AbstractLineWrapPositionStrategyTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/AbstractLineWrapPositionStrategyTest.java new file mode 100644 index 000000000000..5946038158a4 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/AbstractLineWrapPositionStrategyTest.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. + */ +package com.intellij.openapi.editor; + +import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import org.jmock.Expectations; +import org.jmock.Mockery; +import org.jmock.integration.junit4.JUnit4Mockery; +import org.jmock.lib.legacy.ClassImposteriser; + +import static org.junit.Assert.assertSame; + +public abstract class AbstractLineWrapPositionStrategyTest { + private static final String EDGE_MARKER = "<EDGE>"; + private static final String WRAP_MARKER = "<WRAP>"; + private Mockery myMockery; + private Project myProject; + + public void setUp() { + myMockery = new JUnit4Mockery() {{ + setImposteriser(ClassImposteriser.INSTANCE); + }}; + myProject = myMockery.mock(Project.class); + } + + protected void doTest(@NotNull LineWrapPositionStrategy strategy, final String document) { + doTest(strategy, document, true); + } + + protected void doTest(@NotNull LineWrapPositionStrategy strategy, final String document, boolean allowToBeyondMaxPreferredOffset) { + final Context context = new Context(document); + context.init(); + int actual = strategy.calculateWrapPosition( + createMockDocument(context.document), myProject, 0, context.document.length(), context.edgeIndex, + allowToBeyondMaxPreferredOffset, true + ); + assertSame(context.wrapIndex, actual); + } + + private Document createMockDocument(@NotNull final String text) { + final Document result = myMockery.mock(Document.class); + myMockery.checking(new Expectations() {{ + allowing(result).getCharsSequence(); will(returnValue(text)); + }}); + return result; + } + + /** + * Utility class for parsing and initialising test data. + * <p/> + * <b>Note:</b> this class is line-oriented, i.e. it assumes that target document doesn't contain line feeds. + */ + private static class Context { + + private final StringBuilder buffer = new StringBuilder(); + private final String rawDocument; + + private String document; + private int index; + private int wrapIndex = -1; + private int tmpWrapIndex; + private int edgeIndex; + private int tmpEdgeIndex; + + Context(String rawDocument) { + if (rawDocument.contains("\n")) { + throw new IllegalArgumentException( + String.format("Don't expect to test multi-line documents but the one is detected: '%s'", rawDocument) + ); + } + this.rawDocument = rawDocument; + } + + public void init() { + tmpWrapIndex = rawDocument.indexOf(WRAP_MARKER); + tmpEdgeIndex = rawDocument.indexOf(EDGE_MARKER); + if (tmpWrapIndex >= 0 && tmpEdgeIndex >= 0) { + if (tmpWrapIndex < tmpEdgeIndex) { + processWrap(); + processMaxPreferredIndex(); + } + else { + processMaxPreferredIndex(); + processWrap(); + } + } + else { + if (tmpWrapIndex >= 0) { + processWrap(); + } + if (tmpEdgeIndex >= 0) { + processMaxPreferredIndex(); + } + } + + buffer.append(rawDocument.substring(index)); + document = buffer.toString(); + if (edgeIndex <= 0) { + edgeIndex = document.length(); + } + } + + private void processWrap() { + buffer.append(rawDocument.substring(index, tmpWrapIndex)); + index = tmpWrapIndex + WRAP_MARKER.length(); + wrapIndex = buffer.length(); + if (rawDocument.indexOf(WRAP_MARKER, index) >= 0) { + throw new IllegalArgumentException(String.format("More than one wrap indicator is found at the document '%s'", rawDocument)); + } + } + + private void processMaxPreferredIndex() { + buffer.append(rawDocument.substring(index, tmpEdgeIndex)); + index = tmpEdgeIndex + EDGE_MARKER.length(); + edgeIndex = buffer.length(); + if (rawDocument.indexOf(EDGE_MARKER, index) >= 0) { + throw new IllegalArgumentException(String.format("More than one max preferred offset is found at the document '%s'", rawDocument)); + } + } + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java index a4b8ddf29bab..f0e1cf354ef5 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java @@ -15,161 +15,47 @@ */ package com.intellij.openapi.editor; -import com.intellij.openapi.project.Project; -import org.jetbrains.annotations.NotNull; -import org.jmock.Expectations; -import org.jmock.Mockery; -import org.jmock.integration.junit4.JUnit4Mockery; -import org.jmock.lib.legacy.ClassImposteriser; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertSame; - /** * @author Denis Zhdanov * @since Aug 25, 2010 3:20:41 PM */ -public class DefaultLineWrapPositionStrategyTest { - - private static final String EDGE_MARKER = "<EDGE>"; - private static final String WRAP_MARKER = "<WRAP>"; - - private Mockery myMockery; - private DefaultLineWrapPositionStrategy myStrategy; - private Project myProject; +public class DefaultLineWrapPositionStrategyTest extends AbstractLineWrapPositionStrategyTest { + private LineWrapPositionStrategy myStrategy; @Before public void setUp() { + super.setUp(); myStrategy = new DefaultLineWrapPositionStrategy(); - - myMockery = new JUnit4Mockery() {{ - setImposteriser(ClassImposteriser.INSTANCE); - }}; - myProject = myMockery.mock(Project.class); } @Test public void commaNotSeparated() { String document = "void method(String <WRAP>p1<EDGE>, String p2) {}"; - doTest(document, false); + doTest(myStrategy, document, false); } @Test public void wrapOnExceedingWhiteSpace() { String document = "void method(String p1,<WRAP><EDGE> String p2) {}"; - doTest(document); + doTest(myStrategy, document); } @Test public void preferWrapOnComma() { String document = "int variable = testMethod(var1 + var2, <WRAP>var3 + va<EDGE>r4);"; - doTest(document); + doTest(myStrategy, document); } @Test public void longStringWithoutWrapPositionIsNotWrapped() { String document = "-----------------<EDGE>---------------------------------------------------------"; - doTest(document); - } - - private void doTest(final String document) { - doTest(document, true); - } - - private void doTest(final String document, boolean allowToBeyondMaxPreferredOffset) { - final Context context = new Context(document); - context.init(); - int actual = myStrategy.calculateWrapPosition( - createMockDocument(context.document), myProject, 0, context.document.length(), context.edgeIndex, - allowToBeyondMaxPreferredOffset, true - ); - assertSame(context.wrapIndex, actual); - } - - private Document createMockDocument(@NotNull final String text) { - final Document result = myMockery.mock(Document.class); - myMockery.checking(new Expectations() {{ - allowing(result).getCharsSequence(); will(returnValue(text)); - }}); - return result; - } - - /** - * Utility class for parsing and initialising test data. - * <p/> - * <b>Note:</b> this class is line-oriented, i.e. it assumes that target document doesn't contain line feeds. - */ - private static class Context { - - private final StringBuilder buffer = new StringBuilder(); - private final String rawDocument; - - private String document; - private int index; - private int wrapIndex = -1; - private int tmpWrapIndex; - private int edgeIndex; - private int tmpEdgeIndex; - - Context(String rawDocument) { - if (rawDocument.contains("\n")) { - throw new IllegalArgumentException( - String.format("Don't expect to test multi-line documents but the one is detected: '%s'", rawDocument) - ); - } - this.rawDocument = rawDocument; - } - - public void init() { - tmpWrapIndex = rawDocument.indexOf(WRAP_MARKER); - tmpEdgeIndex = rawDocument.indexOf(EDGE_MARKER); - if (tmpWrapIndex >= 0 && tmpEdgeIndex >= 0) { - if (tmpWrapIndex < tmpEdgeIndex) { - processWrap(); - processMaxPreferredIndex(); - } - else { - processMaxPreferredIndex(); - processWrap(); - } - } - else { - if (tmpWrapIndex >= 0) { - processWrap(); - } - if (tmpEdgeIndex >= 0) { - processMaxPreferredIndex(); - } - } - - buffer.append(rawDocument.substring(index)); - document = buffer.toString(); - if (edgeIndex <= 0) { - edgeIndex = document.length(); - } - } - - private void processWrap() { - buffer.append(rawDocument.substring(index, tmpWrapIndex)); - index = tmpWrapIndex + WRAP_MARKER.length(); - wrapIndex = buffer.length(); - if (rawDocument.indexOf(WRAP_MARKER, index) >= 0) { - throw new IllegalArgumentException(String.format("More than one wrap indicator is found at the document '%s'", rawDocument)); - } - } - - private void processMaxPreferredIndex() { - buffer.append(rawDocument.substring(index, tmpEdgeIndex)); - index = tmpEdgeIndex + EDGE_MARKER.length(); - edgeIndex = buffer.length(); - if (rawDocument.indexOf(EDGE_MARKER, index) >= 0) { - throw new IllegalArgumentException(String.format("More than one max preferred offset is found at the document '%s'", rawDocument)); - } - } + doTest(myStrategy, document); } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretColumnModeTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretColumnModeTest.java new file mode 100644 index 000000000000..9b94c44ab059 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretColumnModeTest.java @@ -0,0 +1,199 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.ex.EditorEx; +import com.intellij.testFramework.EditorTestUtil; +import com.intellij.testFramework.LightPlatformCodeInsightTestCase; + +import java.io.IOException; + +public class EditorMultiCaretColumnModeTest extends LightPlatformCodeInsightTestCase { + public void setUp() throws Exception { + super.setUp(); + EditorTestUtil.enableMultipleCarets(); + } + + public void tearDown() throws Exception { + EditorTestUtil.disableMultipleCarets(); + super.tearDown(); + } + + public void testUpDown() throws Exception { + init("line1\n" + + "li<caret>ne2\n" + + "line3"); + + executeAction("EditorDownWithSelection"); + checkResultByText("line1\n" + + "li<caret>ne2\n" + + "li<caret>ne3"); + + executeAction("EditorDownWithSelection"); // hitting document bottom + checkResultByText("line1\n" + + "li<caret>ne2\n" + + "li<caret>ne3"); + + executeAction("EditorUpWithSelection"); + checkResultByText("line1\n" + + "li<caret>ne2\n" + + "line3"); + + executeAction("EditorUpWithSelection"); // hitting document top + checkResultByText("li<caret>ne1\n" + + "li<caret>ne2\n" + + "line3"); + + executeAction("EditorUpWithSelection"); + checkResultByText("li<caret>ne1\n" + + "li<caret>ne2\n" + + "line3"); + + executeAction("EditorDownWithSelection"); + checkResultByText("line1\n" + + "li<caret>ne2\n" + + "line3"); + } + + public void testPageUpDown() throws Exception { + init("line1\n" + + "line2\n" + + "line3\n" + + "line4\n" + + "line<caret>5\n" + + "line6\n" + + "line7"); + EditorTestUtil.setEditorVisibleSize(myEditor, 1000, 3); + + executeAction("EditorPageUpWithSelection"); + checkResultByText("line1\n" + + "line<caret>2\n" + + "line<caret>3\n" + + "line<caret>4\n" + + "line<caret>5\n" + + "line6\n" + + "line7"); + + executeAction("EditorUpWithSelection"); + checkResultByText("line<caret>1\n" + + "line<caret>2\n" + + "line<caret>3\n" + + "line<caret>4\n" + + "line<caret>5\n" + + "line6\n" + + "line7"); + + executeAction("EditorPageDownWithSelection"); + checkResultByText("line1\n" + + "line2\n" + + "line3\n" + + "line<caret>4\n" + + "line<caret>5\n" + + "line6\n" + + "line7"); + + executeAction("EditorPageDownWithSelection"); + checkResultByText("line1\n" + + "line2\n" + + "line3\n" + + "line4\n" + + "line<caret>5\n" + + "line<caret>6\n" + + "line<caret>7"); + + executeAction("EditorPageUpWithSelection"); + checkResultByText("line1\n" + + "line2\n" + + "line3\n" + + "line<caret>4\n" + + "line<caret>5\n" + + "line6\n" + + "line7"); + } + + public void testSelectionWithKeyboard() throws Exception { + init("line1\n" + + "li<caret>ne2\n" + + "line3"); + + executeAction("EditorRightWithSelection"); + checkResultByText("line1\n" + + "li<selection>n<caret></selection>e2\n" + + "line3"); + + executeAction("EditorDownWithSelection"); + checkResultByText("line1\n" + + "li<selection>n<caret></selection>e2\n" + + "li<selection>n<caret></selection>e3"); + + executeAction("EditorLeftWithSelection"); + checkResultByText("line1\n" + + "li<caret>ne2\n" + + "li<caret>ne3"); + + executeAction("EditorLeftWithSelection"); + checkResultByText("line1\n" + + "l<selection><caret>i</selection>ne2\n" + + "l<selection><caret>i</selection>ne3"); + + executeAction("EditorUpWithSelection"); + checkResultByText("line1\n" + + "l<selection><caret>i</selection>ne2\n" + + "line3"); + + executeAction("EditorUpWithSelection"); + checkResultByText("l<selection><caret>i</selection>ne1\n" + + "l<selection><caret>i</selection>ne2\n" + + "line3"); + + executeAction("EditorRightWithSelection"); + checkResultByText("li<caret>ne1\n" + + "li<caret>ne2\n" + + "line3"); + + executeAction("EditorRightWithSelection"); + checkResultByText("li<selection>n<caret></selection>e1\n" + + "li<selection>n<caret></selection>e2\n" + + "line3"); + + executeAction("EditorDownWithSelection"); + checkResultByText("line1\n" + + "li<selection>n<caret></selection>e2\n" + + "line3"); + + executeAction("EditorLeftWithSelection"); + checkResultByText("line1\n" + + "li<caret>ne2\n" + + "line3"); + } + + public void testSelectNextPrevWord() throws Exception { + init("aaa aaa<caret>\n" + + "bbbb bbbb"); + executeAction("EditorDownWithSelection"); + executeAction("EditorPreviousWordWithSelection"); + checkResultByText("aaa <selection><caret>aaa</selection>\n" + + "bbbb <selection><caret>bb</selection>bb"); + executeAction("EditorNextWordWithSelection"); + checkResultByText("aaa aaa<caret>\n" + + "bbbb bb<selection>bb<caret></selection>"); + } + + private void init(String text) throws IOException { + configureFromFileText(getTestName(false) + ".txt", text); + ((EditorEx)myEditor).setColumnMode(true); + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretStateRestoreTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretStateRestoreTest.java index d915753db54c..fdb1af1657fb 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretStateRestoreTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretStateRestoreTest.java @@ -15,9 +15,6 @@ */ package com.intellij.openapi.editor; -import com.intellij.openapi.application.Result; -import com.intellij.openapi.application.WriteAction; -import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.HeavyFileEditorManagerTestCase; @@ -26,7 +23,6 @@ import com.intellij.openapi.fileTypes.PlainTextFileType; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; import com.intellij.testFramework.EditorTestUtil; -import org.jetbrains.annotations.NotNull; public class EditorMultiCaretStateRestoreTest extends HeavyFileEditorManagerTestCase { public void testRestoreState() throws Exception { @@ -54,12 +50,7 @@ public class EditorMultiCaretStateRestoreTest extends HeavyFileEditorManagerTest private static void verifyEditorState(Editor editor, String textWithMarkup) { final Document document = new DocumentImpl(textWithMarkup); - EditorTestUtil.CaretsState caretAndSelectionState = new WriteCommandAction<EditorTestUtil.CaretsState>(null) { - @Override - protected void run(@NotNull Result<EditorTestUtil.CaretsState> result) throws Throwable { - result.setResult(EditorTestUtil.extractCaretAndSelectionMarkers(document)); - } - }.execute().getResultObject(); + EditorTestUtil.CaretAndSelectionState caretAndSelectionState = EditorTestUtil.extractCaretAndSelectionMarkers(document); assertEquals(document.getCharsSequence().toString(), editor.getDocument().getText()); EditorTestUtil.verifyCaretAndSelectionState(editor, caretAndSelectionState); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java index 7dc178471b92..b34b6ed03ba4 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretTest.java @@ -17,14 +17,8 @@ package com.intellij.openapi.editor; import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.editor.impl.AbstractEditorTest; -import com.intellij.openapi.fileEditor.FileEditorManager; -import com.intellij.openapi.fileEditor.OpenFileDescriptor; -import com.intellij.openapi.fileEditor.impl.EditorHistoryManager; -import com.intellij.openapi.project.ex.ProjectManagerEx; -import com.intellij.openapi.project.impl.ProjectManagerImpl; import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.TestFileType; -import com.intellij.testFramework.fixtures.EditorScrollingFixture; public class EditorMultiCaretTest extends AbstractEditorTest { private boolean myStoredVirtualSpaceSetting; @@ -51,19 +45,19 @@ public class EditorMultiCaretTest extends AbstractEditorTest { checkResultByText("some <selection>t<caret>ext</selection>\n" + "a<caret>nother line"); - mouse().alt().shift().clickAt(0,8); // alt-shift-click in existing selection + mouse().alt().shift().clickAt(0, 8); // alt-shift-click in existing selection checkResultByText("some <selection>t<caret>ext</selection>\n" + "a<caret>nother line"); - mouse().alt().shift().clickAt(0,6); // alt-shift-click at existing caret with selection + mouse().alt().shift().clickAt(0, 6); // alt-shift-click at existing caret with selection checkResultByText("some text\n" + "a<caret>nother line"); - mouse().alt().shift().clickAt(1,1); // alt-shift-click at the sole caret + mouse().alt().shift().clickAt(1, 1); // alt-shift-click at the sole caret checkResultByText("some text\n" + "a<caret>nother line"); - mouse().alt().shift().clickAt(0,30); // alt-shift-click in virtual space + mouse().alt().shift().clickAt(0, 30); // alt-shift-click in virtual space checkResultByText("some text<caret>\n" + "a<caret>nother line"); @@ -79,7 +73,7 @@ public class EditorMultiCaretTest extends AbstractEditorTest { "long line\n" + "line", TestFileType.TEXT); - EditorScrollingFixture.setVisibleSize(myEditor, 1000, 1000); + EditorTestUtil.setEditorVisibleSize(myEditor, 1000, 1000); mouse().alt().pressAt(1, 6); checkResultByText("line\n" + @@ -117,7 +111,7 @@ public class EditorMultiCaretTest extends AbstractEditorTest { "long line\n" + "line", TestFileType.TEXT); - EditorScrollingFixture.setVisibleSize(myEditor, 1000, 1000); + EditorTestUtil.setEditorVisibleSize(myEditor, 1000, 1000); mouse().middle().pressAt(1, 17); checkResultByText("line\n" + @@ -152,7 +146,8 @@ public class EditorMultiCaretTest extends AbstractEditorTest { init("some<caret> text<caret>\n" + "some <selection><caret>other</selection> <selection>text<caret></selection>\n" + "<selection>ano<caret>ther</selection> line", - TestFileType.TEXT); + TestFileType.TEXT + ); type('A'); checkResultByText("someA<caret> textA<caret>\n" + "some A<caret> A<caret>\n" + @@ -173,7 +168,8 @@ public class EditorMultiCaretTest extends AbstractEditorTest { public void testCutAndPaste() throws Exception { init("<selection>one<caret></selection> two \n" + "<selection>three<caret></selection> four ", - TestFileType.TEXT); + TestFileType.TEXT + ); executeAction("EditorCut"); executeAction("EditorLineEnd"); executeAction("EditorPaste"); @@ -207,18 +203,4 @@ public class EditorMultiCaretTest extends AbstractEditorTest { "five eightsix \n" + "seven<caret>"); } - - public void testStateStoreAndLoad() throws Exception { - init("some<caret> text<caret>\n" + - "some <selection><caret>other</selection> <selection>text<caret></selection>\n" + - "<selection>ano<caret>ther</selection> line", - TestFileType.TEXT); - EditorHistoryManager.getInstance(ourProject).projectOpened(); - FileEditorManager fileEditorManager = FileEditorManager.getInstance(ourProject); - fileEditorManager.closeFile(myVFile); - myEditor = fileEditorManager.openTextEditor(new OpenFileDescriptor(getProject(), myVFile, 0), false); - checkResultByText("some<caret> text<caret>\n" + - "some <selection><caret>other</selection> <selection>text<caret></selection>\n" + - "<selection>ano<caret>ther</selection> line"); - } } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretUndoRedoTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretUndoRedoTest.java index 8bafc3e0b977..0b168c4cf813 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretUndoRedoTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/EditorMultiCaretUndoRedoTest.java @@ -21,14 +21,12 @@ import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.impl.CurrentEditorProvider; import com.intellij.openapi.command.impl.UndoManagerImpl; import com.intellij.openapi.command.undo.UndoManager; -import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.editor.impl.AbstractEditorTest; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.fileEditor.TextEditor; import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.TestFileType; -import com.intellij.testFramework.fixtures.EditorScrollingFixture; import org.jetbrains.annotations.NotNull; public class EditorMultiCaretUndoRedoTest extends AbstractEditorTest { diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/StripTrailingSpacesTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/StripTrailingSpacesTest.java index 66384b996d50..af0c0e605de1 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/StripTrailingSpacesTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/StripTrailingSpacesTest.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.openapi.editor.ex.DocumentEx; import com.intellij.openapi.editor.ex.EditorSettingsExternalizable; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.impl.TrailingSpacesStripper; +import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.LightPlatformCodeInsightTestCase; import org.jdom.Element; import org.jetbrains.annotations.NonNls; @@ -78,6 +79,17 @@ public class StripTrailingSpacesTest extends LightPlatformCodeInsightTestCase { "xxx\n 222<caret>\nyyy"); } + public void testStrippingWithMultipleCarets() throws Exception { + EditorTestUtil.enableMultipleCarets(); + try { + doTest("xxx\n <caret>\nyyy<caret> ", + "xxx\n <caret>\nyyy<caret>"); + } + finally { + EditorTestUtil.disableMultipleCarets(); + } + } + public void testModifyAndAltTabAway() throws IOException { configureFromFileText("x.txt", "xxx<caret>\nyyy"); type(' '); diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/EditorScrollingFixture.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/TextLineWrapPositionStrategyTest.java index 4b960f6a1869..7d43d7954ada 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/EditorScrollingFixture.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/TextLineWrapPositionStrategyTest.java @@ -13,17 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.testFramework.fixtures; +package com.intellij.openapi.editor; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.ex.EditorEx; -import com.intellij.openapi.editor.ex.util.EditorUtil; +import org.junit.Before; +import org.junit.Test; -import java.awt.*; +public class TextLineWrapPositionStrategyTest extends AbstractLineWrapPositionStrategyTest { + private LineWrapPositionStrategy myStrategy; -public class EditorScrollingFixture { - public static void setVisibleSize(Editor editor, int widthInChars, int heightInChars) { - Dimension size = new Dimension(widthInChars * EditorUtil.getSpaceWidth(Font.PLAIN, editor), heightInChars * editor.getLineHeight()); - ((EditorEx)editor).getScrollPane().getViewport().setExtentSize(size); + @Before + public void setUp() { + super.setUp(); + myStrategy = new TextLineWrapPositionStrategy(); } + + @Test + public void preferNearestWhiteSpaceWrap_InsteadOf_Comma() { + String document = + "queueing the JSON for later submission, we retain the <WRAP>SimpleRequestDa<EDGE>ta"; + doTest(myStrategy, document, false); + } + } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java index 2ac32da3df4f..7c6ce30fd3f6 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/EditorMultiCaretActionTest.java @@ -21,7 +21,6 @@ import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.FileBasedTestCaseHelper; import com.intellij.testFramework.LightPlatformCodeInsightTestCase; import com.intellij.testFramework.TestDataPath; -import com.intellij.testFramework.fixtures.EditorScrollingFixture; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.AfterClass; @@ -49,7 +48,7 @@ public class EditorMultiCaretActionTest extends LightPlatformCodeInsightTestCase @Override protected void run(@NotNull Result<Void> result) throws Throwable { configureByFile(getBeforeFileName()); - EditorScrollingFixture.setVisibleSize(myEditor, 120, 20); // some actions require visible area to be defined, like EditorPageUp + EditorTestUtil.setEditorVisibleSize(myEditor, 120, 20); // some actions require visible area to be defined, like EditorPageUp executeAction(getActionName()); checkResultByFile(getAfterFileName()); } diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java new file mode 100644 index 000000000000..90a82e972379 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/SelectUnselectOccurrenceActionsTest.java @@ -0,0 +1,187 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.actions; + +import com.intellij.codeInsight.hint.EditorHintListener; +import com.intellij.openapi.actionSystem.IdeActions; +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.editor.FoldRegion; +import com.intellij.openapi.editor.FoldingModel; +import com.intellij.openapi.fileTypes.FileTypes; +import com.intellij.openapi.project.Project; +import com.intellij.testFramework.EditorTestUtil; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; +import com.intellij.ui.LightweightHint; + +public class SelectUnselectOccurrenceActionsTest extends LightPlatformCodeInsightFixtureTestCase { + private int hintCount; + + @Override + public void setUp() throws Exception { + super.setUp(); + EditorTestUtil.enableMultipleCarets(); + EditorHintListener listener = new EditorHintListener() { + @Override + public void hintShown(Project project, LightweightHint hint, int flags) { + hintCount++; + } + }; + ApplicationManager.getApplication().getMessageBus().connect(myTestRootDisposable).subscribe(EditorHintListener.TOPIC, listener); + } + + @Override + public void tearDown() throws Exception { + EditorTestUtil.disableMultipleCarets(); + super.tearDown(); + } + + public void testNoInitialSelection() throws Exception { + init("some t<caret>ext\n" + + "some texts\n" + + "another text here" + ); + executeAction(); + checkResult("some <selection>t<caret>ext</selection>\n" + + "some texts\n" + + "another text here"); + executeAction(); + checkResult("some <selection>t<caret>ext</selection>\n" + + "some texts\n" + + "another <selection>t<caret>ext</selection> here"); + assertEquals(0, hintCount); + } + + public void testInitialWholeWordSelection() throws Exception { + init("some <selection>t<caret>ext</selection>\n" + + "some texts\n" + + "another text here"); + executeAction(); + checkResult("some <selection>t<caret>ext</selection>\n" + + "some <selection>t<caret>ext</selection>s\n" + + "another text here"); + assertEquals(0, hintCount); + } + + public void testShowingHint() throws Exception { + init("some <selection>t<caret>ext</selection>\n" + + "another <selection>t<caret>ext</selection> here"); + executeAction(); + assertEquals(1, hintCount); + checkResult("some <selection>t<caret>ext</selection>\n" + + "another <selection>t<caret>ext</selection> here"); + executeAction(); + assertEquals(1, hintCount); + checkResult("some <selection>t<caret>ext</selection>\n" + + "another <selection>t<caret>ext</selection> here"); + } + + public void testRevert() throws Exception { + init("some <selection>t<caret>ext</selection>\n" + + "another <selection>t<caret>ext</selection> here"); + executeReverseAction(); + checkResult("some <selection>t<caret>ext</selection>\n" + + "another text here"); + assertEquals(0, hintCount); + } + + public void testRevertSingleSelection() throws Exception { + init("some <selection>t<caret>ext</selection>\n" + + "some texts\n" + + "another text here"); + executeReverseAction(); + checkResult("some t<caret>ext\n" + + "some texts\n" + + "another text here"); + assertEquals(0, hintCount); + } + + public void testSelectAfterHint() throws Exception { + init("some text\n" + + "some texts\n" + + "another <selection>t<caret>ext</selection> here"); + executeAction(); + checkResult("some text\n" + + "some texts\n" + + "another <selection>t<caret>ext</selection> here"); + assertEquals(1, hintCount); + executeAction(); + checkResult("some <selection>t<caret>ext</selection>\n" + + "some texts\n" + + "another <selection>t<caret>ext</selection> here"); + assertEquals(1, hintCount); + } + + public void testInitialNonWholeWordSelection() throws Exception { + init("some <selection>t<caret>ex</selection>t\n" + + "some texts\n" + + "another text here"); + executeAction(); + checkResult("some <selection>t<caret>ex</selection>t\n" + + "some <selection>t<caret>ex</selection>ts\n" + + "another text here"); + executeAction(); + checkResult("some <selection>t<caret>ex</selection>t\n" + + "some <selection>t<caret>ex</selection>ts\n" + + "another <selection>t<caret>ex</selection>t here"); + assertEquals(0, hintCount); + } + + public void testOccurrenceInCollapsedRegion() throws Exception { + init("normal <selection><caret>line</selection>\n" + + "collapsed line"); + final FoldingModel foldingModel = myFixture.getEditor().getFoldingModel(); + final Document document = myFixture.getEditor().getDocument(); + foldingModel.runBatchFoldingOperation(new Runnable() { + @Override + public void run() { + FoldRegion foldRegion = foldingModel.addFoldRegion(document.getLineStartOffset(1), document.getLineEndOffset(1), "..."); + assertNotNull(foldRegion); + foldRegion.setExpanded(false); + } + }); + executeAction(); + checkResult("normal <selection><caret>line</selection>\n" + + "collapsed <selection><caret>line</selection>"); + FoldRegion[] foldRegions = foldingModel.getAllFoldRegions(); + assertEquals(1, foldRegions.length); + assertTrue(foldRegions[0].isExpanded()); + } + + public void testSelectAfterNotFoundAndUnselect() throws Exception { + init("text <selection><caret>text</selection> <selection><caret>text</selection>"); + executeAction(); + executeReverseAction(); + executeAction(); + checkResult("text <selection><caret>text</selection> <selection><caret>text</selection>"); + } + + private void init(String text) { + myFixture.configureByText(FileTypes.PLAIN_TEXT, text); + } + + private void checkResult(String text) { + myFixture.checkResult(text); + } + + private void executeAction() { + myFixture.performEditorAction(IdeActions.ACTION_SELECT_NEXT_OCCURENCE); + } + + private void executeReverseAction() { + myFixture.performEditorAction(IdeActions.ACTION_UNSELECT_LAST_OCCURENCE); + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/ToggleColumnModeActionMultiCaretTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/ToggleColumnModeActionMultiCaretTest.java new file mode 100644 index 000000000000..d0d10fcbc06d --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/actions/ToggleColumnModeActionMultiCaretTest.java @@ -0,0 +1,112 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.actions; + +import com.intellij.openapi.fileTypes.FileTypes; +import com.intellij.testFramework.EditorTestUtil; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; + +public class ToggleColumnModeActionMultiCaretTest extends LightPlatformCodeInsightFixtureTestCase { + public void setUp() throws Exception { + super.setUp(); + EditorTestUtil.enableMultipleCarets(); + } + + public void tearDown() throws Exception { + EditorTestUtil.disableMultipleCarets(); + super.tearDown(); + } + + public void testSingleCaretWithoutSelection() throws Exception { + doTestToggleOnOff("line1\n" + + "line<caret>2", + + "line1\n" + + "line<caret>2", + + "line1\n" + + "line<caret>2" + ); + } + + public void testSingleCaretWithForwardSelection() throws Exception { + doTestToggleOnOff("l<selection>ine1\n" + + "line<caret></selection>2", + + "l<selection>ine<caret></selection>1\n" + + "l<selection>ine<caret></selection>2", + + "l<selection>ine1\n" + + "line<caret></selection>2" + ); + } + + public void testSingleCaretWithBackwardSelection() throws Exception { + doTestToggleOnOff("l<selection><caret>ine1\n" + + "line</selection>2", + + "l<selection><caret>ine</selection>1\n" + + "l<selection><caret>ine</selection>2", + + "l<selection><caret>ine1\n" + + "line</selection>2" + ); + } + + public void testSingleCaretWithCrossSelection() throws Exception { + doTestToggleOnOff("line<selection><caret>1\n" + + "l</selection>ine2", + + "l<selection>ine<caret></selection>1\n" + + "l<selection>ine<caret></selection>2", + + "line<selection><caret>1\n" + + "l</selection>ine2" + ); + } + + public void testSingleCaretWithCrossSelection2() throws Exception { + doTestToggleOnOff("line<selection>1\n" + + "l<caret></selection>ine2", + + "l<selection><caret>ine</selection>1\n" + + "l<selection><caret>ine</selection>2", + + "line<selection>1\n" + + "l<caret></selection>ine2" + ); + } + + public void testMultipleCarets() throws Exception { + doTestToggleOnOff("<caret>l<selection>ine1\n" + + "line<caret></selection>2", + + "l<selection>ine<caret></selection>1\n" + + "l<selection>ine<caret></selection>2", + + "l<selection>ine1\n" + + "line<caret></selection>2" + ); + } + + private void doTestToggleOnOff(String initialState, String afterToggleOn, String afterToggleOff) { + myFixture.configureByText(FileTypes.PLAIN_TEXT, initialState); + myFixture.performEditorAction("EditorToggleColumnMode"); + myFixture.checkResult(afterToggleOn); + myFixture.performEditorAction("EditorToggleColumnMode"); + myFixture.checkResult(afterToggleOff); + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorLastActionTrackerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorLastActionTrackerTest.java new file mode 100644 index 000000000000..c972183cd3de --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/impl/EditorLastActionTrackerTest.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.editor.impl; + +import com.intellij.openapi.actionSystem.DataContext; +import com.intellij.openapi.editor.Caret; +import com.intellij.openapi.editor.Editor; +import com.intellij.openapi.editor.EditorLastActionTracker; +import com.intellij.openapi.editor.actionSystem.EditorActionHandler; +import com.intellij.openapi.editor.actionSystem.EditorActionManager; +import com.intellij.testFramework.fixtures.EditorMouseFixture; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; +import org.jetbrains.annotations.Nullable; + +public class EditorLastActionTrackerTest extends LightPlatformCodeInsightFixtureTestCase { + public static final String SAMPLE_ACTION = "EditorDelete"; + private final EditorActionHandler myActionHandler = new MyActionHandler(); + + private EditorLastActionTracker myTracker; + private EditorActionHandler mySavedHandler; + + @Override + public void setUp() throws Exception { + super.setUp(); + myTracker = EditorLastActionTracker.getInstance(); + mySavedHandler = EditorActionManager.getInstance().setActionHandler(SAMPLE_ACTION, myActionHandler); + + myFixture.configureByText(getTestName(true) + ".txt", "doesn't matter"); + myFixture.performEditorAction(SAMPLE_ACTION); + } + + @Override + public void tearDown() throws Exception { + EditorActionManager.getInstance().setActionHandler(SAMPLE_ACTION, mySavedHandler); + super.tearDown(); + } + + public void testLastActionIsAvailable() throws Exception { + assertEquals(SAMPLE_ACTION, myTracker.getLastActionId()); + } + + public void testMouseClickClearsLastAction() throws Exception { + new EditorMouseFixture((EditorImpl)myFixture.getEditor()).clickAt(0, 1); + assertNull(myTracker.getLastActionId()); + } + + public void testTypingClearsLastAction() throws Exception { + myFixture.type('A'); + assertNull(myTracker.getLastActionId()); + } + + public void testTwoEditors() throws Exception { + myFixture.configureByText(getTestName(true) + "-other.txt", "doesn't matter as well"); + myFixture.performEditorAction(SAMPLE_ACTION); + } + + private class MyActionHandler extends EditorActionHandler { + @Override + public void execute(Editor editor, @Nullable Caret caret, DataContext dataContext) { + assertNull(myTracker.getLastActionId()); + } + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypesTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypesTest.java new file mode 100644 index 000000000000..4dd03667a52d --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/openapi/fileTypes/FileTypesTest.java @@ -0,0 +1,208 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.fileTypes; + +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileEditor.FileDocumentManager; +import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; +import com.intellij.openapi.fileTypes.impl.FileTypeAssocTable; +import com.intellij.openapi.util.io.FileUtil; +import com.intellij.openapi.vfs.CharsetToolkit; +import com.intellij.openapi.vfs.LocalFileSystem; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.PsiBinaryFile; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiPlainTextFile; +import com.intellij.testFramework.PlatformTestCase; +import com.intellij.util.PatternUtil; + +import java.io.File; +import java.io.IOException; +import java.util.Arrays; +import java.util.regex.Pattern; + +public class FileTypesTest extends PlatformTestCase { + private FileTypeManagerEx myFileTypeManager; + private String myOldIgnoredFilesList; + + @Override + protected void setUp() throws Exception { + super.setUp(); + myFileTypeManager = FileTypeManagerEx.getInstanceEx(); + myOldIgnoredFilesList = myFileTypeManager.getIgnoredFilesList(); + } + + @Override + protected void tearDown() throws Exception { + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + myFileTypeManager.setIgnoredFilesList(myOldIgnoredFilesList); + } + }); + super.tearDown(); + } + + public void testMaskExclude() { + final String pattern1 = "a*b.c?d"; + final String pattern2 = "xxx"; + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + myFileTypeManager.setIgnoredFilesList(pattern1 + ";" + pattern2); + } + }); + checkIgnored("ab.cxd"); + checkIgnored("axb.cxd"); + checkIgnored("xxx"); + checkNotIgnored("ax.cxx"); + checkNotIgnored("ab.cd"); + checkNotIgnored("ab.c__d"); + checkNotIgnored("xx" + "xx"); + checkNotIgnored("xx"); + assertTrue(myFileTypeManager.isIgnoredFilesListEqualToCurrent(pattern2 + ";" + pattern1)); + assertFalse(myFileTypeManager.isIgnoredFilesListEqualToCurrent(pattern2 + ";" + "ab.c*d")); + } + + public void testExcludePerformance() { + runPerformanceTest(true); + } + + public void testMaskToPattern() { + for (char i = 0; i < 256; i++) { + if (i == '?' || i == '*') continue; + String str = "x" + i + "y"; + assertTrue("char: " + i + "(" + (int)i + ")", PatternUtil.fromMask(str).matcher(str).matches()); + } + String allSymbols = "+.\\*/^?$[]()"; + assertTrue(PatternUtil.fromMask(allSymbols).matcher(allSymbols).matches()); + Pattern pattern = PatternUtil.fromMask("?\\?/*"); + assertTrue(pattern.matcher("a\\b/xyz").matches()); + assertFalse(pattern.matcher("x/a\\b").matches()); + } + + public void testAddNewExtension() throws Exception { + FileTypeAssocTable<FileType> associations = new FileTypeAssocTable<FileType>(); + associations.addAssociation(FileTypeManager.parseFromString("*.java"), FileTypes.ARCHIVE); + associations.addAssociation(FileTypeManager.parseFromString("*.xyz"), StdFileTypes.XML); + associations.addAssociation(FileTypeManager.parseFromString("SomeSpecial*.java"), StdFileTypes.XML); // patterns should have precedence over extensions + assertEquals(StdFileTypes.XML, associations.findAssociatedFileType("sample.xyz")); + assertEquals(StdFileTypes.XML, associations.findAssociatedFileType("SomeSpecialFile.java")); + checkNotAssociated(StdFileTypes.XML, "java", associations); + checkNotAssociated(StdFileTypes.XML, "iws", associations); + } + + public void testIgnoreOrder() { + final FileTypeManagerEx manager = FileTypeManagerEx.getInstanceEx(); + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + manager.setIgnoredFilesList("a;b;"); + } + }); + assertEquals("a;b;", manager.getIgnoredFilesList()); + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + manager.setIgnoredFilesList("b;a;"); + } + }); + assertEquals("b;a;", manager.getIgnoredFilesList()); + } + + @SuppressWarnings("deprecation") + private static void checkNotAssociated(FileType fileType, String extension, FileTypeAssocTable<FileType> associations) { + assertFalse(Arrays.asList(associations.getAssociatedExtensions(fileType)).contains(extension)); + } + + private void checkNotIgnored(String fileName) { + assertFalse(myFileTypeManager.isFileIgnored(fileName)); + } + + private void checkIgnored(String fileName) { + assertTrue(myFileTypeManager.isFileIgnored(fileName)); + } + + private void runPerformanceTest(boolean rerunOnOvertime) { + long startTime = System.currentTimeMillis(); + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { + myFileTypeManager.setIgnoredFilesList("1*2;3*4;5*6;7*8;9*0;*1;*3;*5;*6;7*;*8*"); + } + }); + for (int i = 0; i < 100; i++) { + String name = String.valueOf((i%10)*10 + (i*100) + i + 1); + myFileTypeManager.isFileIgnored(name + name + name + name); + } + long time = System.currentTimeMillis() - startTime; + if (time > 700) { + if (rerunOnOvertime) runPerformanceTest(false); + else fail("Time=" + time); + } + } + + public void testAutoDetected() throws IOException { + File dir = createTempDirectory(); + File file = FileUtil.createTempFile(dir, "x", "xxx_xx_xx", true); + FileUtil.writeToFile(file, "xxx xxx xxx xxx"); + VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); + assertNotNull(virtualFile); + PsiFile psi = getPsiManager().findFile(virtualFile); + assertTrue(psi instanceof PsiPlainTextFile); + assertEquals(FileTypes.PLAIN_TEXT, virtualFile.getFileType()); + } + + public void testAutoDetectedWhenDocumentWasCreated() throws IOException { + File dir = createTempDirectory(); + File file = FileUtil.createTempFile(dir, "x", "xxx_xx_xx", true); + FileUtil.writeToFile(file, "xxx xxx xxx xxx"); + VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); + assertNotNull(virtualFile); + Document document = FileDocumentManager.getInstance().getDocument(virtualFile); + assertNotNull(document); + assertEquals(FileTypes.PLAIN_TEXT, virtualFile.getFileType()); + } + + public void testAutoDetectionShouldNotBeOverEager() throws IOException { + File dir = createTempDirectory(); + File file = FileUtil.createTempFile(dir, "x", "xxx_xx_xx", true); + FileUtil.writeToFile(file, "xxx xxx xxx xxx"); + VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); + assertNotNull(virtualFile); + assertEquals(FileTypes.UNKNOWN, virtualFile.getFileType()); + } + + public void testAutoDetectEmptyFile() throws IOException { + File dir = createTempDirectory(); + File file = FileUtil.createTempFile(dir, "x", "xxx_xx_xx", true); + VirtualFile virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file); + assertNotNull(virtualFile); + assertEquals(FileTypes.UNKNOWN, virtualFile.getFileType()); + PsiFile psi = getPsiManager().findFile(virtualFile); + assertTrue(psi instanceof PsiBinaryFile); + assertEquals(FileTypes.UNKNOWN, virtualFile.getFileType()); + + virtualFile.setBinaryContent("xxxxxxx".getBytes(CharsetToolkit.UTF8_CHARSET)); + assertEquals(FileTypes.PLAIN_TEXT, virtualFile.getFileType()); + PsiFile after = getPsiManager().findFile(virtualFile); + assertNotSame(psi, after); + assertFalse(psi.isValid()); + assertTrue(after.isValid()); + assertTrue(after instanceof PsiPlainTextFile); + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/DummyFileSystemTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/DummyFileSystemTest.java index 179b7dc68bb2..1f6a5c027517 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/DummyFileSystemTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/DummyFileSystemTest.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. @@ -19,6 +19,7 @@ import com.intellij.openapi.application.Result; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.vfs.ex.dummy.DummyFileSystem; import com.intellij.testFramework.PlatformLangTestCase; +import org.jetbrains.annotations.NotNull; public class DummyFileSystemTest extends PlatformLangTestCase { private DummyFileSystem fs; @@ -42,12 +43,12 @@ public class DummyFileSystemTest extends PlatformLangTestCase { final VirtualFileEvent[] events = new VirtualFileEvent[2]; fs.addVirtualFileListener(new VirtualFileAdapter() { @Override - public void fileDeleted(VirtualFileEvent e) { + public void fileDeleted(@NotNull VirtualFileEvent e) { events[0] = e; } @Override - public void beforeFileDeletion(VirtualFileEvent e) { + public void beforeFileDeletion(@NotNull VirtualFileEvent e) { events[1] = e; } }); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VirtualFileListenerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VirtualFileListenerTest.java index 59538325b4cc..832093bd7a1e 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VirtualFileListenerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/VirtualFileListenerTest.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,6 +19,7 @@ import com.intellij.openapi.application.Result; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.util.Ref; import com.intellij.testFramework.PlatformLangTestCase; +import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -33,7 +34,7 @@ public class VirtualFileListenerTest extends PlatformLangTestCase { final Ref<Boolean> eventFired = Ref.create(false); VirtualFileManager.getInstance().addVirtualFileListener(new VirtualFileAdapter() { @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { eventFired.set(true); } }, myTestRootDisposable); diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java index 0471db8f1dc4..00b534ac325c 100644 --- a/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java +++ b/platform/platform-tests/testSrc/com/intellij/openapi/vfs/impl/VirtualFilePointerTest.java @@ -478,12 +478,12 @@ public class VirtualFilePointerTest extends PlatformLangTestCase { VirtualFileAdapter listener = new VirtualFileAdapter() { @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { stressRead(pointer); } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { stressRead(pointer); } }; diff --git a/platform/platform-tests/testSrc/com/intellij/patterns/VirtualFilePatternsTest.java b/platform/platform-tests/testSrc/com/intellij/patterns/VirtualFilePatternsTest.java new file mode 100644 index 000000000000..9e0b96788697 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/patterns/VirtualFilePatternsTest.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.patterns; + +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase; + +/** + * @author peter + */ +public class VirtualFilePatternsTest extends LightPlatformCodeInsightFixtureTestCase { + public void testWithSuperParent() { + VirtualFile file = myFixture.addFileToProject("foo/bar.txt", "").getVirtualFile(); + assert PlatformPatterns.virtualFile().withSuperParent(1, PlatformPatterns.virtualFile().withName("foo")).accepts(file); + assert !PlatformPatterns.virtualFile().withSuperParent(1, PlatformPatterns.virtualFile().withName("bar")).accepts(file); + assert !PlatformPatterns.virtualFile().withSuperParent(2, PlatformPatterns.virtualFile().withName("bar")).accepts(file); + assert !PlatformPatterns.virtualFile().withSuperParent(10, PlatformPatterns.virtualFile().withName("bar")).accepts(file); + assert !PlatformPatterns.virtualFile().withSuperParent(10, PlatformPatterns.virtualFile().withName("foo")).accepts(file); + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java b/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java new file mode 100644 index 000000000000..6ccb0581ae96 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/psi/PsiDocumentManagerImplTest.java @@ -0,0 +1,372 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS 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.impl.ProjectUtil; +import com.intellij.mock.MockDocument; +import com.intellij.mock.MockPsiFile; +import com.intellij.openapi.command.WriteCommandAction; +import com.intellij.openapi.editor.Document; +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; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.psi.impl.DebugUtil; +import com.intellij.psi.impl.PsiDocumentManagerImpl; +import com.intellij.psi.impl.source.PsiFileImpl; +import com.intellij.testFramework.LeakHunter; +import com.intellij.testFramework.LightVirtualFile; +import com.intellij.testFramework.PlatformLangTestCase; +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 { + private PsiDocumentManagerImpl getPsiDocumentManager() { + return (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(getProject()); + } + + public void testGetCachedPsiFile_NoFile() throws Exception { + final PsiFile file = getPsiDocumentManager().getCachedPsiFile(new MockDocument()); + assertNull(file); + } + + public void testGetPsiFile_NotRegisteredDocument() throws Exception { + final PsiFile file = getPsiDocumentManager().getPsiFile(new MockDocument()); + assertNull(file); + } + + public void testGetDocument_FirstGet() throws Exception { + VirtualFile vFile = createFile(); + final PsiFile file = new MockPsiFile(vFile, getPsiManager()); + + final Document document = getPsiDocumentManager().getDocument(file); + assertNotNull(document); + assertSame(document, FileDocumentManager.getInstance().getDocument(vFile)); + } + + @Override + protected boolean isRunInWriteAction() { + return false; + } + + private static LightVirtualFile createFile() { + return new LightVirtualFile("foo.txt"); + } + + public void testDocumentGced() throws Exception { + VirtualFile vFile = createFile(); + PsiDocumentManagerImpl documentManager = getPsiDocumentManager(); + long id = System.identityHashCode(documentManager.getDocument(getPsiManager().findFile(vFile))); + + documentManager.commitAllDocuments(); + UIUtil.dispatchAllInvocationEvents(); + UIUtil.dispatchAllInvocationEvents(); + assertEmpty(documentManager.getUncommittedDocuments()); + + LeakHunter.checkLeak(documentManager, DocumentImpl.class); + LeakHunter.checkLeak(documentManager, PsiFileImpl.class, new Processor<PsiFileImpl>() { + @Override + public boolean process(PsiFileImpl psiFile) { + return psiFile.getViewProvider().getVirtualFile().getFileSystem() instanceof LocalFileSystem; + } + }); + //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++) { + UIUtil.dispatchAllInvocationEvents(); + if (reference.get() == null) break; + System.gc(); + } + assertNull(documentManager.getCachedDocument(getPsiManager().findFile(vFile))); + + Document newDoc = documentManager.getDocument(getPsiManager().findFile(vFile)); + assertTrue(id != System.identityHashCode(newDoc)); + } + + public void testGetUncommittedDocuments_noDocuments() throws Exception { + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + } + + public void testGetUncommittedDocuments_documentChanged_DontProcessEvents() throws Exception { + final PsiFile file = getPsiManager().findFile(createFile()); + + final Document document = getPsiDocumentManager().getDocument(file); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + getPsiDocumentManager().getSynchronizer().performAtomically(file, new Runnable() { + @Override + public void run() { + getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false)); + } + }); + } + }); + + + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + } + + public void testGetUncommittedDocuments_documentNotRegistered() throws Exception { + final Document document = new MockDocument(); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false)); + } + }); + + + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + } + + public void testCommitDocument_RemovesFromUncommittedList() throws Exception { + PsiFile file = getPsiManager().findFile(createFile()); + + final Document document = getPsiDocumentManager().getDocument(file); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false)); + } + }); + + + getPsiDocumentManager().commitDocument(document); + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + } + + public void testCommitAllDocument_RemovesFromUncommittedList() throws Exception { + PsiFile file = getPsiManager().findFile(createFile()); + + final Document document = getPsiDocumentManager().getDocument(file); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false)); + } + }); + + + getPsiDocumentManager().commitAllDocuments(); + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + } + + public void testDocumentFromAlienProjectDoesNotEndUpInMyUncommittedList() throws Exception { + PsiFile file = getPsiManager().findFile(createFile()); + + final Document document = getPsiDocumentManager().getDocument(file); + + File temp = createTempDirectory(); + final Project alienProject = createProject(new File(temp, "alien.ipr"), DebugUtil.currentStackTrace()); + boolean succ2 = ProjectManagerEx.getInstanceEx().openProject(alienProject); + assertTrue(succ2); + + + try { + PsiManager alienManager = PsiManager.getInstance(alienProject); + final String alienText = "alien"; + + LightVirtualFile alienVirt = new LightVirtualFile("foo.txt", alienText); + final PsiFile alienFile = alienManager.findFile(alienVirt); + final PsiDocumentManagerImpl alienDocManager = (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(alienProject); + final Document alienDocument = alienDocManager.getDocument(alienFile); + //alienDocument.putUserData(CACHED_VIEW_PROVIDER, new MockFileViewProvider(alienFile)); + assertEquals(0, alienDocManager.getUncommittedDocuments().length); + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + getPsiDocumentManager() + .documentChanged(new DocumentEventImpl(alienDocument, 0, "", "", alienDocument.getModificationStamp(), false)); + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + assertEquals(0, alienDocManager.getUncommittedDocuments().length); + + alienDocManager.documentChanged(new DocumentEventImpl(alienDocument, 0, "", "", alienDocument.getModificationStamp(), false)); + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + assertEquals(1, alienDocManager.getUncommittedDocuments().length); + + getPsiDocumentManager().documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false)); + assertEquals(1, getPsiDocumentManager().getUncommittedDocuments().length); + assertEquals(1, alienDocManager.getUncommittedDocuments().length); + + alienDocManager.documentChanged(new DocumentEventImpl(document, 0, "", "", document.getModificationStamp(), false)); + assertEquals(1, getPsiDocumentManager().getUncommittedDocuments().length); + assertEquals(1, alienDocManager.getUncommittedDocuments().length); + } + }); + } + finally { + ProjectUtil.closeAndDispose(alienProject); + } + } + + public void testCommitInBackground() { + PsiFile file = getPsiManager().findFile(createFile()); + assertNotNull(file); + assertTrue(file.isPhysical()); + final Document document = getPsiDocumentManager().getDocument(file); + assertNotNull(document); + + final Semaphore semaphore = new Semaphore(); + semaphore.down(); + getPsiDocumentManager().performWhenAllCommitted(new Runnable() { + @Override + public void run() { + assertTrue(getPsiDocumentManager().isCommitted(document)); + semaphore.up(); + } + }); + waitAndPump(semaphore, 30000); + assertTrue(getPsiDocumentManager().isCommitted(document)); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + document.insertString(0, "class X {}"); + } + }); + + semaphore.down(); + getPsiDocumentManager().performWhenAllCommitted(new Runnable() { + @Override + public void run() { + assertTrue(getPsiDocumentManager().isCommitted(document)); + semaphore.up(); + } + }); + waitAndPump(semaphore, 30000); + assertTrue(getPsiDocumentManager().isCommitted(document)); + + final AtomicInteger count = new AtomicInteger(); + final Runnable action = new Runnable() { + @Override + public void run() { + count.incrementAndGet(); + } + }; + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + document.insertString(0, "/**/"); + boolean executed = getPsiDocumentManager().cancelAndRunWhenAllCommitted("xxx", action); + assertFalse(executed); + executed = getPsiDocumentManager().cancelAndRunWhenAllCommitted("xxx", action); + assertFalse(executed); + assertEquals(0, count.get()); + } + }); + + while (!getPsiDocumentManager().isCommitted(document)) { + UIUtil.dispatchAllInvocationEvents(); + } + assertTrue(getPsiDocumentManager().isCommitted(document)); + assertEquals(1, count.get()); + + count.set(0); + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + document.insertString(0, "/**/"); + boolean executed = getPsiDocumentManager().performWhenAllCommitted(action); + assertFalse(executed); + executed = getPsiDocumentManager().performWhenAllCommitted(action); + assertFalse(executed); + assertEquals(0, count.get()); + } + }); + + while (!getPsiDocumentManager().isCommitted(document)) { + UIUtil.dispatchAllInvocationEvents(); + } + assertTrue(getPsiDocumentManager().isCommitted(document)); + assertEquals(2, count.get()); + } + + private static void waitAndPump(Semaphore semaphore, int timeout) { + final long limit = System.currentTimeMillis() + timeout; + while (System.currentTimeMillis() < limit) { + if (semaphore.waitFor(10)) return; + UIUtil.dispatchAllInvocationEvents(); + } + fail("Timeout"); + } + + public void testDocumentFromAlienProjectGetsCommittedInBackground() throws Exception { + LightVirtualFile virtualFile = createFile(); + PsiFile file = getPsiManager().findFile(virtualFile); + + final Document document = getPsiDocumentManager().getDocument(file); + + File temp = createTempDirectory(); + final Project alienProject = createProject(new File(temp, "alien.ipr"), DebugUtil.currentStackTrace()); + boolean succ2 = ProjectManagerEx.getInstanceEx().openProject(alienProject); + assertTrue(succ2); + + + try { + PsiManager alienManager = PsiManager.getInstance(alienProject); + + final PsiFile alienFile = alienManager.findFile(virtualFile); + assertNotNull(alienFile); + final PsiDocumentManagerImpl alienDocManager = (PsiDocumentManagerImpl)PsiDocumentManager.getInstance(alienProject); + final Document alienDocument = alienDocManager.getDocument(alienFile); + assertSame(document, alienDocument); + assertEquals(0, alienDocManager.getUncommittedDocuments().length); + assertEquals(0, getPsiDocumentManager().getUncommittedDocuments().length); + + WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override + public void run() { + document.setText("xxx"); + assertOrderedEquals(getPsiDocumentManager().getUncommittedDocuments(), document); + assertOrderedEquals(alienDocManager.getUncommittedDocuments(), alienDocument); + } + }); + assertEquals("xxx", document.getText()); + assertEquals("xxx", alienDocument.getText()); + + while (!getPsiDocumentManager().isCommitted(document)) { + UIUtil.dispatchAllInvocationEvents(); + } + long start = System.currentTimeMillis(); + while (!alienDocManager.isCommitted(alienDocument) && System.currentTimeMillis()-start < 20000) { + UIUtil.dispatchAllInvocationEvents(); + } + assertTrue("Still not committed: "+alienDocument, alienDocManager.isCommitted(alienDocument)); + } + finally { + ProjectUtil.closeAndDispose(alienProject); + } + } +} diff --git a/platform/platform-tests/testSrc/com/intellij/remotesdk/RemoteFileTest.java b/platform/platform-tests/testSrc/com/intellij/remotesdk/RemoteFileTest.java index f988d0cc31b5..d53ae4af054a 100644 --- a/platform/platform-tests/testSrc/com/intellij/remotesdk/RemoteFileTest.java +++ b/platform/platform-tests/testSrc/com/intellij/remotesdk/RemoteFileTest.java @@ -22,10 +22,10 @@ import junit.framework.TestCase; */ public class RemoteFileTest extends TestCase { public void testExtractPathFromFullRemotePath() { - assertEquals("/home/user", RemoteSdkDataHolder.getInterpreterPathFromFullPath("ssh://user@server:8080/home/user")); - assertEquals("C:\\Windows", RemoteSdkDataHolder.getInterpreterPathFromFullPath("ssh://user@server:8080C:\\Windows")); - assertEquals("/home/a@b", RemoteSdkDataHolder.getInterpreterPathFromFullPath("ssh://a@b@server:8080/home/a@b")); - assertEquals("/home/a/b", RemoteSdkDataHolder.getInterpreterPathFromFullPath("ssh://a/b@server:8080/home/a/b")); + assertEquals("/home/user", RemoteSdkCredentialsHolder.getInterpreterPathFromFullPath("ssh://user@server:8080/home/user")); + assertEquals("C:\\Windows", RemoteSdkCredentialsHolder.getInterpreterPathFromFullPath("ssh://user@server:8080C:\\Windows")); + assertEquals("/home/a@b", RemoteSdkCredentialsHolder.getInterpreterPathFromFullPath("ssh://a@b@server:8080/home/a@b")); + assertEquals("/home/a/b", RemoteSdkCredentialsHolder.getInterpreterPathFromFullPath("ssh://a/b@server:8080/home/a/b")); } public void testIsWindowsPath() { diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java b/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java index 2132deb33f1c..e62512ba0669 100644 --- a/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java +++ b/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.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. @@ -123,6 +123,7 @@ public class SmartTreeStructureTest extends LightPlatformCodeInsightFixtureTestC public void testSorting() throws Exception { myModel.addSorter(new Sorter() { + @NotNull @Override public Comparator getComparator() { return new Comparator() { @@ -154,6 +155,7 @@ public class SmartTreeStructureTest extends LightPlatformCodeInsightFixtureTestC }); myModel.addSorter(new Sorter() { + @NotNull @Override public Comparator getComparator() { return new Comparator() { diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java b/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java index f4474c547514..280bfb89eacc 100644 --- a/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java +++ b/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.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.structureView; import com.intellij.ide.util.treeView.AbstractTreeNode; @@ -42,6 +57,7 @@ public class TestGrouper implements Grouper { myChildren = new ArrayList<TreeElement>(children); } + @NotNull @Override public Collection<TreeElement> getChildren() { Collection<TreeElement> result = new LinkedHashSet<TreeElement>(); @@ -53,6 +69,7 @@ public class TestGrouper implements Grouper { return result; } + @NotNull @Override public ItemPresentation getPresentation() { return null; @@ -80,7 +97,7 @@ public class TestGrouper implements Grouper { @Override @NotNull - public Collection<Group> group(final AbstractTreeNode parent, Collection<TreeElement> children) { + public Collection<Group> group(@NotNull final AbstractTreeNode parent, @NotNull Collection<TreeElement> children) { List<Group> result = new ArrayList<Group>(); Collection<String> parentGroupUsedStrings = parent.getValue() instanceof StringGroup ? ((StringGroup)parent.getValue()).myChildrenUsedStrings : diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java b/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java index 7b0da6e39d40..56e628a37fd8 100644 --- a/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java +++ b/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.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.structureView; import com.intellij.ide.projectView.PresentationData; @@ -67,12 +82,14 @@ public class TestTreeModel implements StructureViewModel{ myValue = value; } + @NotNull @Override public StructureViewTreeElement[] getChildren() { return myChildren.toArray(new StructureViewTreeElement[myChildren.size()]); } + @NotNull @Override public ItemPresentation getPresentation() { return new PresentationData(myValue, null, null, null); @@ -114,11 +131,11 @@ public class TestTreeModel implements StructureViewModel{ } @Override - public void addEditorPositionListener(FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { } @Override - public void removeEditorPositionListener(FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { } @Override @@ -131,12 +148,12 @@ public class TestTreeModel implements StructureViewModel{ } @Override - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { } @Override - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { } } diff --git a/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java b/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java index 86464a81e84e..908d74164c11 100644 --- a/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java +++ b/platform/platform-tests/testSrc/com/intellij/ui/FinderRecursivePanelSelectionUpdateTest.java @@ -31,7 +31,7 @@ import java.util.List; @SkipInHeadlessEnvironment public class FinderRecursivePanelSelectionUpdateTest extends PlatformTestCase { - @Bombed(year = 2014, month = Calendar.MARCH, day = 1, user = "Yann Cebron") + @Bombed(year = 2014, month = Calendar.APRIL, day = 1, user = "Yann Cebron") public void testUpdate() throws InterruptedException { StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject()) { @NotNull diff --git a/platform/platform-tests/testSrc/com/intellij/util/net/ssl/CertificateTest.java b/platform/platform-tests/testSrc/com/intellij/util/net/ssl/CertificateTest.java new file mode 100644 index 000000000000..9a544b7158f8 --- /dev/null +++ b/platform/platform-tests/testSrc/com/intellij/util/net/ssl/CertificateTest.java @@ -0,0 +1,120 @@ +package com.intellij.util.net.ssl; + +import com.intellij.testFramework.PlatformTestCase; +import com.intellij.testFramework.PlatformTestUtil; +import org.apache.http.HttpStatus; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; + +import java.io.File; + + +/** + * @author Mikhail Golubev + */ +public class CertificateTest extends PlatformTestCase { + @NonNls private static final String AUTHORITY_CN = "certificates-tests.labs.intellij.net"; + + @NonNls private static final String TRUSTED_CERT_CN = "trusted.certificates-tests.labs.intellij.net"; + @NonNls private static final String EXPIRED_CERT_CN = "expired.certificates-tests.labs.intellij.net"; + @NonNls private static final String SELF_SIGNED_CERT_CN = "self-signed.certificates-tests.labs.intellij.net"; + + // this is the only type of certificates, which 'Common Name' field doesn't match URL of server, where it's located + @NonNls private static final String WRONG_HOSTNAME_CERT_CN = "illegal.certificates-tests.labs.intellij.net"; + @NonNls private static final String WRONG_HOSTNAME_CERT_URL = "https://wrong-hostname.certificates-tests.labs.intellij.net"; + + private CloseableHttpClient myClient; + private ConfirmingTrustManager.MutableTrustManager myTrustManager; + + + /** + * Test that expired certificate doesn't pass JSSE timestamp check and hence untrusted and added explicitly, although + * issued by our test CA. + */ + public void testExpiredCertificate() throws Exception { + doTest(EXPIRED_CERT_CN, true); + } + + /** + * Test that self-signed certificate, that wasn't issued by out test CA, is untrusted and thus added explicitly. + */ + public void testSelfSignedCertificate() throws Exception { + doTest(SELF_SIGNED_CERT_CN, true); + } + + /** + * Hostname validity check (see {@link org.apache.http.conn.ssl.X509HostnameVerifier}) is disabled for now, so + * it merely tests that even certificate with illegal CN field (i.e. it doesn't match requested URL). + * is trusted, because issued by our test CA. + */ + public void testWrongHostnameCertificate() throws Exception { + // wrong hostname doesn't lead to any warning by now, thus it's treated the same as trusted certificate + doTest(WRONG_HOSTNAME_CERT_URL, WRONG_HOSTNAME_CERT_CN, false); + } + + /** + * Test that certificate with correct hostname, validity terms and issued by our test CA is trusted. + */ + public void testTrustedCertificate() throws Exception { + doTest(TRUSTED_CERT_CN, false); + } + + + private void doTest(@NonNls String alias, boolean willBeAdded) throws Exception { + doTest("https://" + alias, alias, willBeAdded); + } + + private void doTest(@NotNull String url, @NotNull String alias, boolean added) throws Exception { + CloseableHttpResponse response = myClient.execute(new HttpGet(url)); + try { + assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); + } + finally { + response.close(); + } + if (added) { + assertTrue(myTrustManager.containsCertificate(alias)); + assertEquals(2, myTrustManager.getCertificates().size()); + } + else { + // only CA certificate + assertEquals(1, myTrustManager.getCertificates().size()); + } + } + + @Override + public void setUp() throws Exception { + super.setUp(); + CertificatesManager certificatesManager = CertificatesManager.getInstance(); + myClient = HttpClientBuilder.create() + .setSslcontext(certificatesManager.getSslContext()) + .setHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER) + .build(); + + // add CA certificate + myTrustManager = certificatesManager.getCustomTrustManager(); + assertTrue(myTrustManager.addCertificate(getTestDataPath() + "certificates/ca.crt")); + assertTrue(myTrustManager.containsCertificate(AUTHORITY_CN)); + } + + @Override + public void tearDown() throws Exception { + try { + assertTrue(myTrustManager.removeAllCertificates()); + assertEmpty(myTrustManager.getCertificates()); + } + finally { + myClient.close(); + } + super.tearDown(); + } + + private static String getTestDataPath() { + return PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/') + "/platform/platform-tests/testData/"; + } +} diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerImpl.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerImpl.java index 0a6047a1fb2a..9fdfeae55282 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerImpl.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/ModuleRootManagerImpl.java @@ -362,6 +362,7 @@ public class ModuleRootManagerImpl extends ModuleRootManager implements ModuleCo }); } else { + myRootModel.dispose(); myRootModel = newModel; } diff --git a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java index 3f811b633d78..1663a0ef327c 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/roots/impl/PushedFilePropertiesUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ import com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBus; import com.intellij.util.messages.MessageBusConnection; +import org.jetbrains.annotations.NotNull; import java.io.IOException; @@ -80,14 +81,14 @@ public class PushedFilePropertiesUpdater { connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkVirtualFileListenerAdapter(new VirtualFileAdapter() { @Override - public void fileCreated(final VirtualFileEvent event) { + public void fileCreated(@NotNull final VirtualFileEvent event) { final VirtualFile file = event.getFile(); final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers; pushRecursively(file, project, pushers); } @Override - public void fileMoved(final VirtualFileMoveEvent event) { + public void fileMoved(@NotNull final VirtualFileMoveEvent event) { final VirtualFile file = event.getFile(); final FilePropertyPusher[] pushers = file.isDirectory() ? myPushers : myFilePushers; for (FilePropertyPusher pusher : pushers) { @@ -149,7 +150,7 @@ public class PushedFilePropertiesUpdater { ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator != null) { indicator.pushState(); - indicator.setText("Updating file properties..."); + indicator.setText("Initializing file system cache..."); } Module[] modules = ModuleManager.getInstance(myProject).getModules(); for (int i1 = 0; i1 < modules.length; i1++) { 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 6ead15621cf8..e377cade4e47 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 @@ -20,10 +20,12 @@ 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.remoteServer.configuration.deployment.DeploymentConfiguration; import com.intellij.util.concurrency.Semaphore; import org.jetbrains.annotations.NotNull; +import javax.swing.*; import java.util.concurrent.atomic.AtomicReference; public abstract class CloudRuntimeTask< @@ -36,6 +38,9 @@ public abstract class CloudRuntimeTask< private final Project myProject; private final String myTitle; + private final AtomicReference<Boolean> mySuccess = new AtomicReference<Boolean>(); + private final AtomicReference<String> myErrorMessage = new AtomicReference<String>(); + public CloudRuntimeTask(Project project, String title) { myProject = project; myTitle = title; @@ -87,6 +92,9 @@ public abstract class CloudRuntimeTask< }; } + mySuccess.set(false); + myErrorMessage.set(null); + AtomicReference<T> result = new AtomicReference<T>(); run(semaphore, result); @@ -110,6 +118,7 @@ public abstract class CloudRuntimeTask< public void run() { try { result.set(CloudRuntimeTask.this.run(serverRuntime)); + mySuccess.set(true); } catch (ServerRuntimeException e) { runtimeErrorOccurred(e.getMessage()); @@ -122,9 +131,21 @@ public abstract class CloudRuntimeTask< } protected void runtimeErrorOccurred(@NotNull String errorMessage) { + myErrorMessage.set(errorMessage); LOG.info(errorMessage); } + public void showMessageDialog(JComponent component, String successMessage, String title) { + if (mySuccess.get()) { + Messages.showInfoMessage(component, successMessage, title); + return; + } + String errorMessage = myErrorMessage.get(); + if (errorMessage != null) { + Messages.showErrorDialog(component, errorMessage, title); + } + } + protected abstract SR getServerRuntime(); protected abstract T run(SR serverRuntime) throws ServerRuntimeException; diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java index 9eb3ea3e7fd8..1aca1ecdc4a9 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/util/ssh/SshKeyChecker.java @@ -18,8 +18,15 @@ package com.intellij.remoteServer.util.ssh; import com.intellij.execution.filters.HyperlinkInfo; import com.intellij.notification.Notification; import com.intellij.notification.NotificationListener; +import com.intellij.openapi.options.ConfigurationException; +import com.intellij.openapi.options.UnnamedConfigurable; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; +import com.intellij.openapi.ui.Messages; +import com.intellij.remoteServer.ServerType; +import com.intellij.remoteServer.configuration.RemoteServer; +import com.intellij.remoteServer.configuration.ServerConfiguration; +import com.intellij.remoteServer.impl.configuration.RemoteServerImpl; import com.intellij.remoteServer.runtime.ServerConnection; import com.intellij.remoteServer.runtime.ServerConnectionManager; import com.intellij.remoteServer.runtime.deployment.DeploymentLogManager; @@ -27,10 +34,12 @@ import com.intellij.remoteServer.runtime.deployment.DeploymentTask; import com.intellij.remoteServer.runtime.log.LoggingHandler; import com.intellij.remoteServer.runtime.ui.RemoteServersView; import com.intellij.remoteServer.util.*; +import com.intellij.ui.HyperlinkLabel; import com.intellij.util.ParameterizedRunnable; import org.jetbrains.annotations.NotNull; import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; import java.io.File; /** @@ -63,6 +72,13 @@ public class SshKeyChecker { } } + public <C extends ServerConfiguration> void setupUploadLabel(HyperlinkLabel label, + UnnamedConfigurable serverConfigurable, + C serverConfiguration, + ServerType<C> serverType) { + new ConfigurableHandler<C>(label, serverConfigurable, serverConfiguration, serverType); + } + private class ServerHandler extends HandlerBase { private final CloudNotifier myNotifier; @@ -210,6 +226,62 @@ public class SshKeyChecker { } } + private class ConfigurableHandler<C extends ServerConfiguration> extends HandlerBase implements HyperlinkListener { + + private final UnnamedConfigurable myServerConfigurable; + private final C myServerConfiguration; + private final ServerType<C> myServerType; + + private final HyperlinkLabel myLabel; + + public ConfigurableHandler(HyperlinkLabel label, + final UnnamedConfigurable serverConfigurable, + C serverConfiguration, + ServerType<C> serverType) { + myServerConfigurable = serverConfigurable; + myServerConfiguration = serverConfiguration; + myServerType = serverType; + + label.setHyperlinkText("Upload Public SSH Key"); + label.addHyperlinkListener(this); + myLabel = label; + } + + @Override + public void hyperlinkUpdate(HyperlinkEvent e) { + chooseKey(); + } + + @Override + protected void uploadKey(final File sskKey) { + try { + myServerConfigurable.apply(); + } + catch (ConfigurationException e) { + Messages.showErrorDialog("Cannot upload SSH key: " + e.getMessage(), e.getTitle()); + return; + } + + RemoteServer<C> server = new RemoteServerImpl<C>("<temp server to upload ssh key>", myServerType, myServerConfiguration); + + CloudConnectionTask task = new CloudConnectionTask(null, "Uploading SSH key", server) { + + @Override + protected Object run(CloudServerRuntimeInstance serverRuntime) throws ServerRuntimeException { + ((SshKeyAwareServerRuntime)serverRuntime).addSshKey(sskKey); + return null; + } + }; + task.performSync(); + task.showMessageDialog(myLabel, "SSH key was uploaded", "Public SSH Key"); + } + + @Override + protected Project getProject() { + return null; + } + } + private static abstract class HandlerBase { protected void chooseKey() { diff --git a/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java b/platform/structure-view-api/src/com/intellij/ide/projectView/PresentationData.java index 18cd07311f41..435c5ef9279d 100644 --- a/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java +++ b/platform/structure-view-api/src/com/intellij/ide/projectView/PresentationData.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/ide/projectView/RootsProvider.java b/platform/structure-view-api/src/com/intellij/ide/projectView/RootsProvider.java index 6a7ca09059c4..2f341936fb3d 100644 --- a/platform/lang-api/src/com/intellij/ide/projectView/RootsProvider.java +++ b/platform/structure-view-api/src/com/intellij/ide/projectView/RootsProvider.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.ide.projectView; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.containers.HashSet; +import org.jetbrains.annotations.NotNull; import java.util.Collection; import java.util.Set; @@ -25,6 +26,7 @@ public interface RootsProvider { Set<VirtualFile> EMPTY_ROOTS = new HashSet<VirtualFile>(); + @NotNull Collection<VirtualFile> getRoots(); } diff --git a/platform/core-api/src/com/intellij/psi/util/PsiMatcherExpression.java b/platform/structure-view-api/src/com/intellij/ide/projectView/SettingsProvider.java index 75af6d0543dc..e7163ba361c1 100644 --- a/platform/core-api/src/com/intellij/psi/util/PsiMatcherExpression.java +++ b/platform/structure-view-api/src/com/intellij/ide/projectView/SettingsProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.psi.util; +package com.intellij.ide.projectView; -import com.intellij.psi.PsiElement; - -public interface PsiMatcherExpression { - Boolean match(PsiElement element); +public interface SettingsProvider { + ViewSettings getSettings(); } diff --git a/platform/lang-api/src/com/intellij/ide/projectView/TreeStructureProvider.java b/platform/structure-view-api/src/com/intellij/ide/projectView/TreeStructureProvider.java index 0ecf0f2c90ef..315a41ec6a81 100644 --- a/platform/lang-api/src/com/intellij/ide/projectView/TreeStructureProvider.java +++ b/platform/structure-view-api/src/com/intellij/ide/projectView/TreeStructureProvider.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. @@ -17,6 +17,7 @@ package com.intellij.ide.projectView; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.extensions.ExtensionPointName; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; @@ -38,7 +39,8 @@ public interface TreeStructureProvider { * @return the modified collection of child nodes, or <code>children</code> if no modifications * are required. */ - Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings); + @NotNull + Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings); /** * Returns a user data object of the specified type for the specified selection in the diff --git a/platform/lang-api/src/com/intellij/ide/projectView/ViewSettings.java b/platform/structure-view-api/src/com/intellij/ide/projectView/ViewSettings.java index bc11154a08ad..4229fcf47440 100644 --- a/platform/lang-api/src/com/intellij/ide/projectView/ViewSettings.java +++ b/platform/structure-view-api/src/com/intellij/ide/projectView/ViewSettings.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java b/platform/structure-view-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java index 9dc167caac50..ad7a2ce32239 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/structureView/ModelListener.java b/platform/structure-view-api/src/com/intellij/ide/structureView/ModelListener.java index e633d227dfc7..3ec8c284c6ca 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/ModelListener.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/ModelListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/structureView/StructureView.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java index ee4817ae5a5f..604fa00b2841 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureView.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilder.java index 87ba9c5e7b4d..ceaab48de15b 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,5 +49,5 @@ public interface StructureViewBuilder { * @see TreeBasedStructureViewBuilder */ @NotNull - StructureView createStructureView(FileEditor fileEditor, Project project); + StructureView createStructureView(FileEditor fileEditor, @NotNull Project project); } diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java index 55495001457f..5d70e3d95c7d 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewFactory.java index e10f3c190a69..1d2bf73f10f7 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.ide.structureView; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; /** * Factory interface for creating instances of the standard structure view component. @@ -31,9 +32,10 @@ public abstract class StructureViewFactory { * @param project the project containing the file for which the structure view is requested. * @return the structure view instance. */ + @NotNull public abstract StructureView createStructureView(FileEditor fileEditor, - StructureViewModel treeModel, - Project project); + @NotNull StructureViewModel treeModel, + @NotNull Project project); /** * Creates a structure view component instance for the specified editor. @@ -44,10 +46,11 @@ public abstract class StructureViewFactory { * @param showRootNode pass <code>false</code> if root node of the structure built should not actually be shown in result tree. * @return the structure view instance. */ + @NotNull public abstract StructureView createStructureView(FileEditor fileEditor, - StructureViewModel treeModel, - Project project, - boolean showRootNode); + @NotNull StructureViewModel treeModel, + @NotNull Project project, + boolean showRootNode); public static StructureViewFactory getInstance(Project project) { return ServiceManager.getService(project, StructureViewFactory.class); diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModel.java index 61009d21c34c..551d70d055e1 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +41,7 @@ public interface StructureViewModel extends TreeModel { * * @param listener the listener to add. */ - void addEditorPositionListener(FileEditorPositionListener listener); + void addEditorPositionListener(@NotNull FileEditorPositionListener listener); /** * Removes a listener which gets notified when the selection in the editor linked to the @@ -49,7 +49,7 @@ public interface StructureViewModel extends TreeModel { * * @param listener the listener to remove. */ - void removeEditorPositionListener(FileEditorPositionListener listener); + void removeEditorPositionListener(@NotNull FileEditorPositionListener listener); /** * Adds a listener which gets notified when the data represented by the structure view @@ -57,7 +57,7 @@ public interface StructureViewModel extends TreeModel { * * @param modelListener the listener to add. */ - void addModelListener(ModelListener modelListener); + void addModelListener(@NotNull ModelListener modelListener); /** * Removes a listener which gets notified when the data represented by the structure view @@ -65,13 +65,14 @@ public interface StructureViewModel extends TreeModel { * * @param modelListener the listener to remove. */ - void removeModelListener(ModelListener modelListener); + void removeModelListener(@NotNull ModelListener modelListener); /** * Returns the root element of the structure view tree. * * @return the structure view root. */ + @Override @NotNull StructureViewTreeElement getRoot(); @@ -83,15 +84,12 @@ public interface StructureViewModel extends TreeModel { boolean shouldEnterElement(Object element); interface ElementInfoProvider extends StructureViewModel { - boolean isAlwaysShowsPlus(StructureViewTreeElement element); - boolean isAlwaysLeaf(StructureViewTreeElement element); - } interface ExpandInfoProvider { - boolean isAutoExpand(StructureViewTreeElement element); + boolean isAutoExpand(@NotNull StructureViewTreeElement element); boolean isSmartExpand(); } } diff --git a/platform/lang-api/src/com/intellij/ide/structureView/StructureViewModelBase.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModelBase.java index f38ef1503ddf..ac191b813ffd 100644 --- a/platform/lang-api/src/com/intellij/ide/structureView/StructureViewModelBase.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModelBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,9 +37,7 @@ public class StructureViewModelBase extends TextEditorBasedStructureViewModel { } public StructureViewModelBase(@NotNull PsiFile psiFile, @NotNull StructureViewTreeElement root) { - super(psiFile); - - myRoot = root; + this(psiFile, null, root); } @Override @@ -48,12 +46,14 @@ public class StructureViewModelBase extends TextEditorBasedStructureViewModel { return myRoot; } - public StructureViewModelBase withSorters(Sorter... sorters) { + @NotNull + public StructureViewModelBase withSorters(@NotNull Sorter... sorters) { mySorters = sorters; return this; } - public StructureViewModelBase withSuitableClasses(Class... suitableClasses) { + @NotNull + public StructureViewModelBase withSuitableClasses(@NotNull Class... suitableClasses) { mySuitableClasses = suitableClasses; return this; } diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java index 81010a383d9f..1b666467585e 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,4 @@ public interface StructureViewTreeElement extends TreeElement, Navigatable{ * @return the data object instance. */ Object getValue(); - - /*StructureViewTreeElement[] getChildren();*/ } diff --git a/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java b/platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java index 02d63de0e0de..5cef3a5801a6 100644 --- a/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java @@ -24,7 +24,7 @@ import com.intellij.openapi.editor.event.CaretListener; import com.intellij.openapi.util.Disposer; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; -import com.intellij.psi.util.PsiUtilBase; +import com.intellij.psi.util.PsiEditorUtil; import com.intellij.util.ArrayUtil; import com.intellij.util.ReflectionUtil; import com.intellij.util.containers.ContainerUtil; @@ -54,7 +54,7 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView * @param psiFile the file for which the structure view model is requested. */ protected TextEditorBasedStructureViewModel(@NotNull PsiFile psiFile) { - this(PsiUtilBase.findEditor(psiFile), psiFile); + this(PsiEditorUtil.Service.getInstance().findEditorByPsiElement(psiFile), psiFile); } /** @@ -85,12 +85,12 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView } @Override - public final void addEditorPositionListener(FileEditorPositionListener listener) { + public final void addEditorPositionListener(@NotNull FileEditorPositionListener listener) { myListeners.add(listener); } @Override - public final void removeEditorPositionListener(FileEditorPositionListener listener) { + public final void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) { myListeners.remove(listener); } @@ -136,12 +136,12 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView } @Override - public void addModelListener(ModelListener modelListener) { + public void addModelListener(@NotNull ModelListener modelListener) { } @Override - public void removeModelListener(ModelListener modelListener) { + public void removeModelListener(@NotNull ModelListener modelListener) { } diff --git a/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java b/platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java index ec30047809be..c0152c7f64ad 100644 --- a/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.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,8 +33,7 @@ import org.jetbrains.annotations.Nullable; * @see TextEditorBasedStructureViewModel * @see com.intellij.lang.LanguageStructureViewBuilder#getStructureViewBuilder(com.intellij.psi.PsiFile) */ -public abstract class - TreeBasedStructureViewBuilder implements StructureViewBuilder { +public abstract class TreeBasedStructureViewBuilder implements StructureViewBuilder { /** * @deprecated Use createStructureViewModel(Editor editor) */ @@ -60,7 +59,7 @@ public abstract class @Override @NotNull - public StructureView createStructureView(FileEditor fileEditor, Project project) { + public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) { final StructureViewModel model = createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null); StructureView view = StructureViewFactory.getInstance(project).createStructureView(fileEditor, model, project, isRootNodeShown()); Disposer.register(view, new Disposable() { @@ -79,4 +78,4 @@ public abstract class public boolean isRootNodeShown() { return true; } -}
\ No newline at end of file +} diff --git a/platform/platform-api/src/com/intellij/ide/structureView/package.html b/platform/structure-view-api/src/com/intellij/ide/structureView/package.html index 15d0ffec725e..15d0ffec725e 100644 --- a/platform/platform-api/src/com/intellij/ide/structureView/package.html +++ b/platform/structure-view-api/src/com/intellij/ide/structureView/package.html diff --git a/platform/structure-view-api/src/com/intellij/ide/util/ActionShortcutProvider.java b/platform/structure-view-api/src/com/intellij/ide/util/ActionShortcutProvider.java new file mode 100644 index 000000000000..26c5c9388373 --- /dev/null +++ b/platform/structure-view-api/src/com/intellij/ide/util/ActionShortcutProvider.java @@ -0,0 +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.ide.util; + +import org.jetbrains.annotations.NotNull; + +// used in the implementation of FileStructureNodeProvider to avoid dependency on KeyMapManager in com.intellij.ide.util.FileStructureNodeProvider.getShortcut() +public interface ActionShortcutProvider { + @NotNull + String getActionIdForShortcut(); +} diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureFilter.java b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureFilter.java index 9c2f7b230ecc..f8fa7a877f40 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureFilter.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,12 +18,15 @@ package com.intellij.ide.util; import com.intellij.ide.util.treeView.smartTree.Filter; import com.intellij.openapi.actionSystem.Shortcut; +import org.jetbrains.annotations.NotNull; /** * @author yole */ public interface FileStructureFilter extends Filter { + @NotNull String getCheckBoxText(); + @NotNull Shortcut[] getShortcut(); } diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureNodeProvider.java b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureNodeProvider.java index 524354442e1b..2bf37e2635c1 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureNodeProvider.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureNodeProvider.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. @@ -18,12 +18,15 @@ package com.intellij.ide.util; import com.intellij.ide.util.treeView.smartTree.NodeProvider; import com.intellij.ide.util.treeView.smartTree.TreeElement; import com.intellij.openapi.actionSystem.Shortcut; +import org.jetbrains.annotations.NotNull; /** * @author Konstantin Bulenkov */ public interface FileStructureNodeProvider<T extends TreeElement> extends NodeProvider<T> { + @NotNull String getCheckBoxText(); + @NotNull Shortcut[] getShortcut(); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java index d722c2c6444e..ada9c64047e6 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.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,7 +69,7 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst } @Override - protected void postprocess(PresentationData presentation) { + protected void postprocess(@NotNull PresentationData presentation) { if (hasProblemFileBeneath() ) { presentation.setAttributesKey(CodeInsightColors.ERRORS_ATTRIBUTES); } @@ -81,7 +81,7 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst } } - protected void setForcedForeground(PresentationData presentation) { + protected void setForcedForeground(@NotNull PresentationData presentation) { final FileStatus status = getFileStatus(); Color fgColor = getFileStatusColor(status); fgColor = fgColor == null ? status.getColor() : fgColor; @@ -145,18 +145,11 @@ public abstract class AbstractTreeNode<T> extends PresentableNodeDescriptor<Abst if (myValue == null) { return null; } - else { - return (T)TreeAnchorizer.getService().retrieveElement(myValue); - } + return (T)TreeAnchorizer.getService().retrieveElement(myValue); } public final void setValue(T value) { - if (value == null) { - myValue = null; - } - else { - myValue = TreeAnchorizer.getService().createAnchor(value); - } + myValue = value == null ? null : TreeAnchorizer.getService().createAnchor(value); } public final Object getEqualityObject() { diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java index 380c76e2351d..acd6548ff26d 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeStructure.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/AlphaComparator.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AlphaComparator.java index b5a71e4375d2..c97bfe5c9296 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/AlphaComparator.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AlphaComparator.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/platform/platform-api/src/com/intellij/ide/util/treeView/IndexComparator.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/IndexComparator.java index 07d38c9662a8..662b358aeea6 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/IndexComparator.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/IndexComparator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/NodeDescriptor.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/NodeDescriptor.java index dc5e236f6717..b49d89bea205 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeDescriptor.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/NodeDescriptor.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/platform-api/src/com/intellij/ide/util/treeView/NodeDescriptorProvidingKey.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/NodeDescriptorProvidingKey.java index 2755f0292458..2bca0fc31b84 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeDescriptorProvidingKey.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/NodeDescriptorProvidingKey.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/NodeOptions.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/NodeOptions.java index 376a25b554b1..324f1a58009c 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/NodeOptions.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/NodeOptions.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java index c6b832350fbe..1850778d706b 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/PresentableNodeDescriptor.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. @@ -99,7 +99,7 @@ public abstract class PresentableNodeDescriptor<E> extends NodeDescriptor<E> { return new PresentationData(); } - protected void postprocess(PresentationData date) { + protected void postprocess(@NotNull PresentationData date) { } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java index 058139e34ef7..1da325dcd5db 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.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/platform/platform-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java index 4884ca1f804e..7b4e1f83b690 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/TreeVisitor.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeVisitor.java index 2744537e60e4..211abb1b5c72 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeVisitor.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/ValidateableNode.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/ValidateableNode.java index f08ba88976f5..f8f3c3d6fddf 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/ValidateableNode.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/ValidateableNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/WeighedItem.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/WeighedItem.java index ad2552cd62f2..edbe752d3208 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/WeighedItem.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/WeighedItem.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,4 +20,4 @@ package com.intellij.ide.util.treeView; */ public interface WeighedItem { int getWeight(); -}
\ No newline at end of file +} diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java index 0a95507ac9f1..8ba47d5b32e1 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,6 +15,8 @@ */ package com.intellij.ide.util.treeView.smartTree; +import org.jetbrains.annotations.NotNull; + import javax.swing.*; /** @@ -31,6 +33,7 @@ public interface ActionPresentation { * * @return the action name. */ + @NotNull String getText(); /** diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java index d5194afe675d..1a85799128cc 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,6 +15,8 @@ */ package com.intellij.ide.util.treeView.smartTree; +import org.jetbrains.annotations.NotNull; + import javax.swing.*; /** @@ -35,13 +37,14 @@ public class ActionPresentationData implements ActionPresentation { * @param icon the icon for the action, displayed on the toolbar button. */ - public ActionPresentationData(String text, String description, Icon icon) { + public ActionPresentationData(@NotNull String text, String description, Icon icon) { myText = text; myDescription = description; myIcon = icon; } @Override + @NotNull public String getText() { return myText; } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java index f418858a8f1b..3cd07474612f 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/smartTree/Group.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Group.java index b1ba9a31d8e0..9623cf6a5c4e 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Group.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Group.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.navigation.ItemPresentation; +import org.jetbrains.annotations.NotNull; import java.util.Collection; @@ -30,6 +31,7 @@ public interface Group { * * @return the group presentation. */ + @NotNull ItemPresentation getPresentation(); /** @@ -37,5 +39,6 @@ public interface Group { * * @return the list of nodes. */ + @NotNull Collection<TreeElement> getChildren(); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java index 83381b65c2b0..9c36f0c5f867 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,5 +37,6 @@ public interface Grouper extends TreeAction { * @param children the children of the parent node. * @return the collection of groups */ - @NotNull Collection<Group> group(final AbstractTreeNode parent, Collection<TreeElement> children); + @NotNull + Collection<Group> group(@NotNull AbstractTreeNode parent, @NotNull Collection<TreeElement> children); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java index d55e73200e90..ea97b85b78b0 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.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. @@ -15,11 +15,14 @@ */ package com.intellij.ide.util.treeView.smartTree; +import org.jetbrains.annotations.NotNull; + import java.util.Collection; /** * @author Konstantin Bulenkov */ public interface NodeProvider<T extends TreeElement> extends TreeAction { - Collection<T> provideNodes(TreeElement node); + @NotNull + Collection<T> provideNodes(@NotNull TreeElement node); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java index 8e2263cf6bca..cd2f7a0df243 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.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. diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java index fda76a576379..6ec0f5484b57 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,10 +16,13 @@ package com.intellij.ide.util.treeView.smartTree; +import org.jetbrains.annotations.NotNull; + /** * Item in a smart tree which allows using a custom text (other than the presentable text) * as a key for alphabetic sorting. */ public interface SortableTreeElement { + @NotNull String getAlphaSortKey(); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java index 1b0728de37de..cd0f2dbf6516 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java index 5434bc082bab..cabcc7a7ac0d 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.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. @@ -15,6 +15,8 @@ */ package com.intellij.ide.util.treeView.smartTree; +import org.jetbrains.annotations.NotNull; + /** * @author Konstantin Bulenkov */ @@ -22,16 +24,19 @@ public class SorterUtil { private SorterUtil() { } + @NotNull public static String getStringPresentation(Object object) { String result = null; if (object instanceof SortableTreeElement) { - result = ((SortableTreeElement) object).getAlphaSortKey(); - } else if (object instanceof TreeElement){ - result = ((TreeElement)object).getPresentation().getPresentableText(); - } else if (object instanceof Group){ + result = ((SortableTreeElement)object).getAlphaSortKey(); + } + else if (object instanceof TreeElement) { + result = ((TreeElement)object).getPresentation().getPresentableText(); + } + else if (object instanceof Group) { result = ((Group)object).getPresentation().getPresentableText(); } - return result != null ? result : ""; + return result == null ? "" : result; } } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java index e35ec5df5dbb..82b907195b04 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java index b672bfa947ef..407c4437e57b 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.navigation.ItemPresentation; +import org.jetbrains.annotations.NotNull; /** * An element in a generic tree control displayed in the IDEA user interface. @@ -24,11 +25,13 @@ import com.intellij.navigation.ItemPresentation; */ public interface TreeElement { + TreeElement[] EMPTY_ARRAY = new TreeElement[0]; /** * Returns the presentation of the tree element. * * @return the element presentation. */ + @NotNull ItemPresentation getPresentation(); /** @@ -36,5 +39,6 @@ public interface TreeElement { * * @return the list of children. */ + @NotNull TreeElement[] getChildren(); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java index 0375e32eae03..675c7041cd3e 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,7 +29,8 @@ public interface TreeModel { * * @return the tree root. */ - @NotNull TreeElement getRoot(); + @NotNull + TreeElement getRoot(); /** * Returns the list of actions for grouping items in the tree. @@ -37,7 +38,8 @@ public interface TreeModel { * @return the array of grouping actions. * @see Grouper#EMPTY_ARRAY */ - @NotNull Grouper[] getGroupers(); + @NotNull + Grouper[] getGroupers(); /** * Returns the array of actions for sorting items in the tree. @@ -45,7 +47,8 @@ public interface TreeModel { * @return the array of sorting actions. * @see Sorter#EMPTY_ARRAY */ - @NotNull Sorter[] getSorters(); + @NotNull + Sorter[] getSorters(); /** * Returns the array of actions for filtering items in the tree. @@ -53,5 +56,6 @@ public interface TreeModel { * @return the array of filtering actions. * @see Filter#EMPTY_ARRAY */ - @NotNull Filter[] getFilters(); + @NotNull + Filter[] getFilters(); } diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/package.html b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/package.html index ecb0c9412c8f..ecb0c9412c8f 100644 --- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/package.html +++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/package.html diff --git a/platform/lang-api/src/com/intellij/lang/LanguageStructureViewBuilder.java b/platform/structure-view-api/src/com/intellij/lang/LanguageStructureViewBuilder.java index 924f53f6f6f5..e2e4ac1e17a3 100644 --- a/platform/lang-api/src/com/intellij/lang/LanguageStructureViewBuilder.java +++ b/platform/structure-view-api/src/com/intellij/lang/LanguageStructureViewBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.lang; import com.intellij.ide.structureView.StructureViewBuilder; import com.intellij.psi.PsiFile; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class LanguageStructureViewBuilder extends LanguageExtension<PsiStructureViewFactory>{ @@ -31,7 +32,7 @@ public class LanguageStructureViewBuilder extends LanguageExtension<PsiStructure } @Nullable - public StructureViewBuilder getStructureViewBuilder(PsiFile file) { + public StructureViewBuilder getStructureViewBuilder(@NotNull PsiFile file) { PsiStructureViewFactory factory = forLanguage(file.getLanguage()); if (factory != null) { return factory.getStructureViewBuilder(file); diff --git a/platform/lang-api/src/com/intellij/lang/PsiStructureViewFactory.java b/platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java index ca9ab8589ed6..afe96269e775 100644 --- a/platform/lang-api/src/com/intellij/lang/PsiStructureViewFactory.java +++ b/platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/navigation/AnonymousElementProvider.java b/platform/structure-view-api/src/com/intellij/navigation/AnonymousElementProvider.java index 2d56cd99c7f3..f7369ca57278 100644 --- a/platform/lang-api/src/com/intellij/navigation/AnonymousElementProvider.java +++ b/platform/structure-view-api/src/com/intellij/navigation/AnonymousElementProvider.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. @@ -17,6 +17,7 @@ package com.intellij.navigation; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; /** * @author Konstantin Bulenkov @@ -24,5 +25,6 @@ import com.intellij.psi.PsiElement; public interface AnonymousElementProvider { ExtensionPointName<AnonymousElementProvider> EP_NAME = ExtensionPointName.create("com.intellij.anonymousElementProvider"); - PsiElement[] getAnonymousElements(PsiElement parent); + @NotNull + PsiElement[] getAnonymousElements(@NotNull PsiElement parent); } diff --git a/platform/platform-api/src/com/intellij/openapi/util/PropertyOwner.java b/platform/structure-view-api/src/com/intellij/openapi/util/PropertyOwner.java index d8aa8b40840b..c344f15a4e23 100644 --- a/platform/platform-api/src/com/intellij/openapi/util/PropertyOwner.java +++ b/platform/structure-view-api/src/com/intellij/openapi/util/PropertyOwner.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/structure-view-api/structure-view-api.iml b/platform/structure-view-api/structure-view-api.iml new file mode 100644 index 000000000000..199e5f92fca9 --- /dev/null +++ b/platform/structure-view-api/structure-view-api.iml @@ -0,0 +1,31 @@ +<?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" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="util" exported="" /> + <orderEntry type="module" module-name="extensions" exported="" /> + <orderEntry type="module" module-name="core-api" exported="" /> + <orderEntry type="library" exported="" name="picocontainer" level="project" /> + <orderEntry type="module" module-name="bootstrap" /> + <orderEntry type="library" exported="" name="commons-codec" level="project" /> + <orderEntry type="module" module-name="platform-resources-en" exported="" /> + <orderEntry type="module" module-name="icons" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/../../lib/automaton.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module" module-name="projectModel-api" exported="" /> + <orderEntry type="module" module-name="editor-ui-api" exported="" /> + </component> +</module> + diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java b/platform/structure-view-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java index 9601bfb5dc26..e07d30e77c6e 100644 --- a/platform/lang-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java +++ b/platform/structure-view-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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-impl/src/com/intellij/ide/structureView/StructureViewExtension.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewExtension.java index f92690bacb90..ee94c38030b8 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewExtension.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java index dd371e72ed63..d1cf194d0ddb 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.ide.structureView; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; @@ -30,7 +31,8 @@ public abstract class StructureViewFactoryEx extends StructureViewFactory { @Nullable public abstract StructureViewWrapper getStructureViewWrapper(); - public abstract Collection<StructureViewExtension> getAllExtensions(Class<? extends PsiElement> type); + @NotNull + public abstract Collection<StructureViewExtension> getAllExtensions(@NotNull Class<? extends PsiElement> type); public abstract void setActiveAction(final String name, final boolean state); @@ -40,5 +42,5 @@ public abstract class StructureViewFactoryEx extends StructureViewFactory { return (StructureViewFactoryEx)getInstance(project); } - public abstract void runWhenInitialized(Runnable runnable); -}
\ No newline at end of file + public abstract void runWhenInitialized(@NotNull Runnable runnable); +} diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java index 17edcf03b9e1..df3f820f708c 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java index 5d5f42974461..7251d0917ad4 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java index 55f09ca297d8..63f77962fced 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ public class StructureViewElementWrapper<V extends PsiElement> implements Struct return (V)myTreeElement.getValue(); } + @NotNull @Override public StructureViewTreeElement[] getChildren() { TreeElement[] baseChildren = myTreeElement.getChildren(); @@ -63,6 +64,7 @@ public class StructureViewElementWrapper<V extends PsiElement> implements Struct return result.toArray(new StructureViewTreeElement[result.size()]); } + @NotNull @Override public ItemPresentation getPresentation() { return myTreeElement.getPresentation(); diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java index e7301cd5be8b..dbc91a77dec6 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,22 +45,22 @@ public class StructureViewModelWrapper implements StructureViewModel { } @Override - public void addEditorPositionListener(final FileEditorPositionListener listener) { + public void addEditorPositionListener(@NotNull final FileEditorPositionListener listener) { myStructureViewModel.addEditorPositionListener(listener); } @Override - public void removeEditorPositionListener(final FileEditorPositionListener listener) { + public void removeEditorPositionListener(@NotNull final FileEditorPositionListener listener) { myStructureViewModel.removeEditorPositionListener(listener); } @Override - public void addModelListener(final ModelListener modelListener) { + public void addModelListener(@NotNull final ModelListener modelListener) { myStructureViewModel.addModelListener(modelListener); } @Override - public void removeModelListener(final ModelListener modelListener) { + public void removeModelListener(@NotNull final ModelListener modelListener) { myStructureViewModel.removeModelListener(modelListener); } diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java index 2e2f7252b81a..403487d4a8e1 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java index 513e31f6be73..9d851c00f31e 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java +++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ public abstract class PsiTreeElementBase <T extends PsiElement> implements Struc myValue = psiElement; } + @NotNull @Override public ItemPresentation getPresentation() { return this; @@ -94,6 +95,7 @@ public abstract class PsiTreeElementBase <T extends PsiElement> implements Struc return element != null ? element.toString() : ""; } + @NotNull @Override public final StructureViewTreeElement[] getChildren() { final T element = getElement(); diff --git a/platform/lang-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java b/platform/structure-view-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java index 1ffb48293675..c74d7e06887e 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.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. @@ -21,26 +21,33 @@ import com.intellij.ide.util.treeView.smartTree.ActionPresentation; import com.intellij.ide.util.treeView.smartTree.ActionPresentationData; import com.intellij.ide.util.treeView.smartTree.TreeElement; import com.intellij.openapi.actionSystem.Shortcut; -import com.intellij.openapi.keymap.KeymapManager; +import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; /** * @author Konstantin Bulenkov */ -public abstract class InheritedMembersNodeProvider<T extends TreeElement> implements FileStructureNodeProvider<T> { +public abstract class InheritedMembersNodeProvider<T extends TreeElement> implements FileStructureNodeProvider<T>, ActionShortcutProvider { @NonNls public static final String ID = "SHOW_INHERITED"; + @NotNull @Override public String getCheckBoxText() { return IdeBundle.message("file.structure.toggle.show.inherited"); } + @NotNull @Override public Shortcut[] getShortcut() { - return KeymapManager.getInstance().getActiveKeymap().getShortcuts("FileStructurePopup"); + throw new IncorrectOperationException("see getActionIdForShortcut()"); } + @NotNull + @Override + public String getActionIdForShortcut() { + return "FileStructurePopup"; + } @Override @NotNull diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java index 6ba301ad9b67..0a516ae16501 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java @@ -16,7 +16,7 @@ package com.intellij.ide.util.treeView; -import com.intellij.ide.projectView.ProjectViewNode; +import com.intellij.ide.projectView.SettingsProvider; import com.intellij.ide.projectView.TreeStructureProvider; import com.intellij.ide.projectView.ViewSettings; import com.intellij.openapi.diagnostic.Logger; @@ -47,7 +47,7 @@ public abstract class AbstractTreeStructureBase extends AbstractTreeStructure { Collection<? extends AbstractTreeNode> elements = treeNode.getChildren(); List<TreeStructureProvider> providers = getProvidersDumbAware(); if (!providers.isEmpty()) { - ViewSettings settings = treeNode instanceof ProjectViewNode ? ((ProjectViewNode) treeNode).getSettings() : ViewSettings.DEFAULT; + ViewSettings settings = treeNode instanceof SettingsProvider ? ((SettingsProvider)treeNode).getSettings() : ViewSettings.DEFAULT; for (TreeStructureProvider provider : providers) { try { elements = provider.modify(treeNode, (Collection<AbstractTreeNode>)elements, settings); diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java index a81d18f13792..f08fb99cf4bf 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.ide.structureView.impl.StructureViewElementWrapper; import com.intellij.ide.util.treeView.AbstractTreeNode; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.pom.Navigatable; import gnu.trove.THashMap; @@ -26,6 +27,7 @@ import org.jetbrains.annotations.NotNull; import java.util.*; public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<Value> { + private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode"); private List<CachingChildrenTreeNode> myChildren; private List<CachingChildrenTreeNode> myOldChildren = null; protected final TreeModel myTreeModel; @@ -95,12 +97,13 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V } } - protected void filterChildren(Filter[] filters) { + protected void filterChildren(@NotNull Filter[] filters) { Collection<AbstractTreeNode> children = getChildren(); for (Filter filter : filters) { for (Iterator<AbstractTreeNode> eachNode = children.iterator(); eachNode.hasNext();) { TreeElementWrapper eachChild = (TreeElementWrapper)eachNode.next(); - if (!filter.isVisible(eachChild.getValue())) { + TreeElement value = eachChild.getValue(); + if (value == null || !filter.isVisible(value)) { eachNode.remove(); } } @@ -108,7 +111,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V setChildren(children); } - protected void groupChildren(Grouper[] groupers) { + protected void groupChildren(@NotNull Grouper[] groupers) { for (Grouper grouper : groupers) { groupElements(grouper); } @@ -147,16 +150,22 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V setChildren(result); } - private void processUngrouped(List<AbstractTreeNode<TreeElement>> ungrouped, Grouper grouper) { + private void processUngrouped(@NotNull List<AbstractTreeNode<TreeElement>> ungrouped, @NotNull Grouper grouper) { Map<TreeElement,AbstractTreeNode> ungroupedObjects = collectValues(ungrouped); Collection<Group> groups = grouper.group(this, ungroupedObjects.keySet()); Map<Group, GroupWrapper> groupNodes = createGroupNodes(groups); for (Group group : groups) { + if (group == null) { + LOG.error(grouper + " returned null group: "+groups); + } GroupWrapper groupWrapper = groupNodes.get(group); Collection<TreeElement> children = group.getChildren(); for (TreeElement node : children) { + if (node == null) { + LOG.error(group + " returned null child: " + children); + } CachingChildrenTreeNode child = createChildNode(node); groupWrapper.addSubElement(child); AbstractTreeNode abstractTreeNode = ungroupedObjects.get(node); @@ -165,7 +174,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V } } - protected TreeElementWrapper createChildNode(final TreeElement child) { + protected TreeElementWrapper createChildNode(@NotNull TreeElement child) { return new TreeElementWrapper(getProject(), child, myTreeModel); } @@ -177,7 +186,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V return objects; } - private Map<Group, GroupWrapper> createGroupNodes(Collection<Group> groups) { + private Map<Group, GroupWrapper> createGroupNodes(@NotNull Collection<Group> groups) { Map<Group, GroupWrapper> result = new THashMap<Group, GroupWrapper>(); for (Group group : groups) { result.put(group, createGroupWrapper(getProject(), group, myTreeModel)); @@ -185,7 +194,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V return result; } - protected GroupWrapper createGroupWrapper(final Project project, Group group, final TreeModel treeModel) { + protected GroupWrapper createGroupWrapper(final Project project, @NotNull Group group, final TreeModel treeModel) { return new GroupWrapper(project, group, treeModel); } @@ -225,7 +234,7 @@ public abstract class CachingChildrenTreeNode <Value> extends AbstractTreeNode<V } } - protected abstract void copyFromNewInstance(final CachingChildrenTreeNode newInstance); + protected abstract void copyFromNewInstance(@NotNull CachingChildrenTreeNode newInstance); protected abstract void performTreeActions(); diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/GroupWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/GroupWrapper.java index 59502003a951..da2835ebec56 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/GroupWrapper.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/GroupWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,19 +17,21 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.ide.projectView.PresentationData; -import com.intellij.navigation.ItemPresentation; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; import java.util.Collection; public class GroupWrapper extends CachingChildrenTreeNode<Group> { + private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.GroupWrapper"); public GroupWrapper(Project project, Group value, TreeModel treeModel) { super(project, value, treeModel); clearChildren(); } @Override - public void copyFromNewInstance(final CachingChildrenTreeNode newInstance) { + public void copyFromNewInstance(@NotNull final CachingChildrenTreeNode newInstance) { clearChildren(); setChildren(newInstance.getChildren()); synchronizeChildren(); @@ -43,8 +45,12 @@ public class GroupWrapper extends CachingChildrenTreeNode<Group> { @Override public void initChildren() { clearChildren(); - Collection<TreeElement> children = getValue().getChildren(); + Group group = getValue(); + Collection<TreeElement> children = group.getChildren(); for (TreeElement child : children) { + if (child == null) { + LOG.error(group + " returned null child: " + children); + } TreeElementWrapper childNode = createChildNode(child); addSubElement(childNode); } diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java index e2a10b4d421b..478c160b8c14 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java index a0dafb0ed58f..ac1660aea6a0 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,17 +18,21 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.ide.projectView.PresentationData; import com.intellij.ide.structureView.StructureViewTreeElement; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; +import org.jetbrains.annotations.NotNull; +import java.util.Arrays; import java.util.Collection; public class TreeElementWrapper extends CachingChildrenTreeNode<TreeElement> { + private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.TreeElementWrapper"); public TreeElementWrapper(Project project, TreeElement value, TreeModel treeModel) { super(project, value, treeModel); } @Override - public void copyFromNewInstance(final CachingChildrenTreeNode oldInstance) { + public void copyFromNewInstance(@NotNull final CachingChildrenTreeNode oldInstance) { } @Override @@ -41,16 +45,23 @@ public class TreeElementWrapper extends CachingChildrenTreeNode<TreeElement> { @Override public void initChildren() { clearChildren(); - TreeElement[] children = getValue().getChildren(); + TreeElement value = getValue(); + TreeElement[] children = value.getChildren(); for (TreeElement child : children) { + if (child == null) { + LOG.error(value + " returned null child: " + Arrays.toString(children)); + } addSubElement(createChildNode(child)); } if (myTreeModel instanceof ProvidingTreeModel) { final Collection<NodeProvider> providers = ((ProvidingTreeModel)myTreeModel).getNodeProviders(); for (NodeProvider provider : providers) { if (((ProvidingTreeModel)myTreeModel).isEnabled(provider)) { - final Collection<TreeElement> nodes = provider.provideNodes(getValue()); + final Collection<TreeElement> nodes = provider.provideNodes(value); for (TreeElement node : nodes) { + if (node == null) { + LOG.error(provider + " returned null node: " + nodes); + } addSubElement(createChildNode(node)); } } diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java index a08f3180b109..ce62a748559e 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java +++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,9 @@ package com.intellij.ide.util.treeView.smartTree; import com.intellij.ide.util.treeView.AbstractTreeStructure; +import com.intellij.ui.PlaceHolder; +import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import java.util.HashSet; @@ -24,6 +27,8 @@ import java.util.HashSet; * @author Maxim.Mossienko */ public class TreeStructureUtil { + public static final String PLACE = "StructureViewPopup"; + private TreeStructureUtil() {} public static Object[] getChildElementsFromTreeStructure(AbstractTreeStructure treeStructure, Object element) { @@ -37,4 +42,13 @@ public class TreeStructureUtil { return items; } + + public static boolean isInStructureViewPopup(@NotNull PlaceHolder<String> model) { + return PLACE.equals(model.getPlace()); + } + + @NonNls + public static String getPropertyName(String propertyName) { + return propertyName + ".file.structure.state"; + } } diff --git a/platform/structure-view-impl/structure-view-impl.iml b/platform/structure-view-impl/structure-view-impl.iml new file mode 100644 index 000000000000..35a80b95dec3 --- /dev/null +++ b/platform/structure-view-impl/structure-view-impl.iml @@ -0,0 +1,13 @@ +<?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" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="structure-view-api" exported="" /> + </component> +</module> + diff --git a/platform/testFramework/src/_FirstInSuiteTest.java b/platform/testFramework/src/_FirstInSuiteTest.java index 663f6a131eba..b3886f756814 100644 --- a/platform/testFramework/src/_FirstInSuiteTest.java +++ b/platform/testFramework/src/_FirstInSuiteTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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.testFramework.LightPlatformTestCase; * This is should be first test in all tests so we can measure how long tests are starting up. * @author max */ +@SuppressWarnings("JUnitTestClassNamingConvention") public class _FirstInSuiteTest extends LightPlatformTestCase { public void testNothing() throws Exception { diff --git a/platform/testFramework/src/_LastInSuiteTest.java b/platform/testFramework/src/_LastInSuiteTest.java index 78431fe12fef..352c2340e4d6 100644 --- a/platform/testFramework/src/_LastInSuiteTest.java +++ b/platform/testFramework/src/_LastInSuiteTest.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. @@ -14,6 +14,8 @@ * limitations under the License. */ +import com.intellij.openapi.application.ApplicationManager; +import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.util.Disposer; import com.intellij.testFramework.LeakHunter; @@ -22,10 +24,13 @@ import com.intellij.util.ReflectionUtil; import com.intellij.util.ui.UIUtil; import junit.framework.TestCase; +import java.lang.reflect.Method; + /** * This must be the last test. * @author max */ +@SuppressWarnings("JUnitTestClassNamingConvention") public class _LastInSuiteTest extends TestCase { public void testProjectLeak() throws Exception { new WriteCommandAction.Simple(null) { @@ -39,6 +44,7 @@ public class _LastInSuiteTest extends TestCase { UIUtil.invokeAndWaitIfNeeded(new Runnable() { @Override public void run() { + ((ApplicationImpl)ApplicationManager.getApplication()).setDisposeInProgress(true); LightPlatformTestCase.disposeApplication(); } }); @@ -55,9 +61,11 @@ public class _LastInSuiteTest extends TestCase { private static void captureMemorySnapshot() { try { - ReflectionUtil.getMethod(Class.forName("com.intellij.util.ProfilingUtil"), "forceCaptureMemorySnapshot").invoke(null); - } - catch (Exception ignored) { + Method snapshot = ReflectionUtil.getMethod(Class.forName("com.intellij.util.ProfilingUtil"), "forceCaptureMemorySnapshot"); + if (snapshot != null) { + snapshot.invoke(null); + } } + catch (Exception ignored) { } } } diff --git a/platform/testFramework/src/com/intellij/mock/Mock.java b/platform/testFramework/src/com/intellij/mock/Mock.java index 87e13adf2473..d511f2fd2d35 100644 --- a/platform/testFramework/src/com/intellij/mock/Mock.java +++ b/platform/testFramework/src/com/intellij/mock/Mock.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.mock; import com.intellij.codeHighlighting.BackgroundEditorHighlighter; @@ -135,6 +150,7 @@ public class Mock { return new ActionCallback.Done(); } + @NotNull @Override public ActionCallback getReady(@NotNull Object requestor) { return new ActionCallback.Done(); diff --git a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java index b80b2350b8f5..5d658bfe7e3a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java @@ -17,15 +17,20 @@ package com.intellij.testFramework; import com.intellij.ide.DataManager; import com.intellij.openapi.actionSystem.*; +import com.intellij.openapi.application.Result; +import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.editor.*; import com.intellij.openapi.editor.actionSystem.EditorActionHandler; import com.intellij.openapi.editor.actionSystem.EditorActionManager; import com.intellij.openapi.editor.actionSystem.TypedAction; +import com.intellij.openapi.editor.ex.EditorEx; +import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.highlighter.EditorHighlighter; 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.mapping.SoftWrapApplianceManager; +import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; @@ -34,6 +39,7 @@ import junit.framework.Assert; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.awt.*; import java.util.ArrayList; import java.util.List; @@ -183,12 +189,17 @@ public class EditorTestUtil { return !model.getRegisteredSoftWraps().isEmpty(); } + public static void setEditorVisibleSize(Editor editor, int widthInChars, int heightInChars) { + Dimension size = new Dimension(widthInChars * EditorUtil.getSpaceWidth(Font.PLAIN, editor), heightInChars * editor.getLineHeight()); + ((EditorEx)editor).getScrollPane().getViewport().setExtentSize(size); + } + /** * Equivalent to <code>extractCaretAndSelectionMarkers(document, true)</code>. * * @see #extractCaretAndSelectionMarkers(com.intellij.openapi.editor.Document, boolean) */ - public static CaretsState extractCaretAndSelectionMarkers(Document document) { + public static CaretAndSelectionState extractCaretAndSelectionMarkers(Document document) { return extractCaretAndSelectionMarkers(document, true); } @@ -196,119 +207,177 @@ public class EditorTestUtil { * Removes <caret>, <selection> and </selection> tags from document and returns a list of caret positions and selection * ranges for each caret. Both caret positions and selection ranges can be null in the returned data. * - * Should be invoked in write action, as it modifies the document! - * * @param processBlockSelection if <code>true</code>, <block> and </block> tags describing a block selection state will also be extracted. */ - public static CaretsState extractCaretAndSelectionMarkers(Document document, boolean processBlockSelection) { - CaretsState result = new CaretsState(); - - String fileText = document.getText(); - - RangeMarker blockSelectionStartMarker = null; - RangeMarker blockSelectionEndMarker = null; - if (processBlockSelection) { - int blockSelectionStart = fileText.indexOf(BLOCK_SELECTION_START_TAG); - int blockSelectionEnd = fileText.indexOf(BLOCK_SELECTION_END_TAG); - if ((blockSelectionStart ^ blockSelectionEnd) < 0) { - throw new IllegalArgumentException("Both block selection opening and closing tag must be present"); - } - if (blockSelectionStart >= 0) { - blockSelectionStartMarker = document.createRangeMarker(blockSelectionStart, blockSelectionStart); - blockSelectionEndMarker = document.createRangeMarker(blockSelectionEnd, blockSelectionEnd); - document.deleteString(blockSelectionStartMarker.getStartOffset(), blockSelectionStartMarker.getStartOffset() + BLOCK_SELECTION_START_TAG.length()); - document.deleteString(blockSelectionEndMarker.getStartOffset(), blockSelectionEndMarker.getStartOffset() + BLOCK_SELECTION_END_TAG.length()); - } - } + public static CaretAndSelectionState extractCaretAndSelectionMarkers(final Document document, final boolean processBlockSelection) { + return new WriteCommandAction<CaretAndSelectionState>(null) { + @Override + public void run(@NotNull Result<CaretAndSelectionState> actionResult) { + final CaretAndSelectionState result = new CaretAndSelectionState(); + String fileText = document.getText(); + + RangeMarker blockSelectionStartMarker = null; + RangeMarker blockSelectionEndMarker = null; + if (processBlockSelection) { + int blockSelectionStart = fileText.indexOf(BLOCK_SELECTION_START_TAG); + int blockSelectionEnd = fileText.indexOf(BLOCK_SELECTION_END_TAG); + if ((blockSelectionStart ^ blockSelectionEnd) < 0) { + throw new IllegalArgumentException("Both block selection opening and closing tag must be present"); + } + if (blockSelectionStart >= 0) { + blockSelectionStartMarker = document.createRangeMarker(blockSelectionStart, blockSelectionStart); + blockSelectionEndMarker = document.createRangeMarker(blockSelectionEnd, blockSelectionEnd); + document.deleteString(blockSelectionStartMarker.getStartOffset(), blockSelectionStartMarker.getStartOffset() + BLOCK_SELECTION_START_TAG.length()); + document.deleteString(blockSelectionEndMarker.getStartOffset(), blockSelectionEndMarker.getStartOffset() + BLOCK_SELECTION_END_TAG.length()); + } + } - boolean multiCaret = StringUtil.getOccurrenceCount(document.getText(), CARET_TAG) > 1 - || StringUtil.getOccurrenceCount(document.getText(), SELECTION_START_TAG) > 1; - int pos = 0; - while (pos < document.getTextLength()) { - fileText = document.getText(); - int caretIndex = fileText.indexOf(CARET_TAG, pos); - int selStartIndex = fileText.indexOf(SELECTION_START_TAG, pos); - int selEndIndex = fileText.indexOf(SELECTION_END_TAG, pos); - - if ((selStartIndex ^ selEndIndex) < 0) { - selStartIndex = -1; - selEndIndex = -1; - } - if (0 <= selEndIndex && selEndIndex < selStartIndex) { - throw new IllegalArgumentException("Wrong order of selection opening and closing tags"); - } - if (caretIndex < 0 && selStartIndex < 0 && selEndIndex < 0) { - break; - } - if (multiCaret && 0 <= caretIndex && caretIndex < selStartIndex) { - selStartIndex = -1; - selEndIndex = -1; - } - if (multiCaret && caretIndex > selEndIndex && selEndIndex >= 0) { - caretIndex = -1; - } + boolean multiCaret = StringUtil.getOccurrenceCount(document.getText(), CARET_TAG) > 1 + || StringUtil.getOccurrenceCount(document.getText(), SELECTION_START_TAG) > 1; + int pos = 0; + while (pos < document.getTextLength()) { + fileText = document.getText(); + int caretIndex = fileText.indexOf(CARET_TAG, pos); + int selStartIndex = fileText.indexOf(SELECTION_START_TAG, pos); + int selEndIndex = fileText.indexOf(SELECTION_END_TAG, pos); + + if ((selStartIndex ^ selEndIndex) < 0) { + selStartIndex = -1; + selEndIndex = -1; + } + if (0 <= selEndIndex && selEndIndex < selStartIndex) { + throw new IllegalArgumentException("Wrong order of selection opening and closing tags"); + } + if (caretIndex < 0 && selStartIndex < 0 && selEndIndex < 0) { + break; + } + if (multiCaret && 0 <= caretIndex && caretIndex < selStartIndex) { + selStartIndex = -1; + selEndIndex = -1; + } + if (multiCaret && caretIndex > selEndIndex && selEndIndex >= 0) { + caretIndex = -1; + } - final RangeMarker caretMarker = caretIndex >= 0 ? document.createRangeMarker(caretIndex, caretIndex) : null; - final RangeMarker selStartMarker = selStartIndex >= 0 - ? document.createRangeMarker(selStartIndex, selStartIndex) - : null; - final RangeMarker selEndMarker = selEndIndex >= 0 - ? document.createRangeMarker(selEndIndex, selEndIndex) - : null; + final RangeMarker caretMarker = caretIndex >= 0 ? document.createRangeMarker(caretIndex, caretIndex) : null; + final RangeMarker selStartMarker = selStartIndex >= 0 + ? document.createRangeMarker(selStartIndex, selStartIndex) + : null; + final RangeMarker selEndMarker = selEndIndex >= 0 + ? document.createRangeMarker(selEndIndex, selEndIndex) + : null; - if (caretMarker != null) { - document.deleteString(caretMarker.getStartOffset(), caretMarker.getStartOffset() + CARET_TAG.length()); - } - if (selStartMarker != null) { - document.deleteString(selStartMarker.getStartOffset(), - selStartMarker.getStartOffset() + SELECTION_START_TAG.length()); - } - if (selEndMarker != null) { - document.deleteString(selEndMarker.getStartOffset(), - selEndMarker.getStartOffset() + SELECTION_END_TAG.length()); - } + if (caretMarker != null) { + document.deleteString(caretMarker.getStartOffset(), caretMarker.getStartOffset() + CARET_TAG.length()); + } + if (selStartMarker != null) { + document.deleteString(selStartMarker.getStartOffset(), + selStartMarker.getStartOffset() + SELECTION_START_TAG.length()); + } + if (selEndMarker != null) { + document.deleteString(selEndMarker.getStartOffset(), + selEndMarker.getStartOffset() + SELECTION_END_TAG.length()); + } + + LogicalPosition caretPosition = null; + if (caretMarker != null) { + int line = document.getLineNumber(caretMarker.getStartOffset()); + int column = caretMarker.getStartOffset() - document.getLineStartOffset(line); + caretPosition = new LogicalPosition(line, column); + } + result.carets.add(new CaretInfo(caretPosition, + selStartMarker == null || selEndMarker == null + ? null + : new TextRange(selStartMarker.getStartOffset(), selEndMarker.getEndOffset()))); - result.carets.add(new Caret(caretMarker == null ? null : caretMarker.getStartOffset(), - selStartMarker == null || selEndMarker == null - ? null - : new TextRange(selStartMarker.getStartOffset(), selEndMarker.getEndOffset()))); + pos = Math.max(caretMarker == null ? -1 : caretMarker.getStartOffset(), selEndMarker == null ? -1 : selEndMarker.getEndOffset()); + } + if (result.carets.isEmpty()) { + result.carets.add(new CaretInfo(null, null)); + } + if (blockSelectionStartMarker != null) { + result.blockSelection = new TextRange(blockSelectionStartMarker.getStartOffset(), blockSelectionEndMarker.getStartOffset()); + } + actionResult.setResult(result); + } + }.execute().getResultObject(); + } - pos = Math.max(caretMarker == null ? -1 : caretMarker.getStartOffset(), selEndMarker == null ? -1 : selEndMarker.getEndOffset()); + /** + * Applies given caret/selection state to the editor. Editor text must have been set up previously. + */ + public static void setCaretsAndSelection(Editor editor, CaretAndSelectionState caretsState) { + CaretModel caretModel = editor.getCaretModel(); + if (caretModel.supportsMultipleCarets()) { + List<LogicalPosition> caretPositions = new ArrayList<LogicalPosition>(); + List<Segment> selections = new ArrayList<Segment>(); + for (CaretInfo caret : caretsState.carets) { + caretPositions.add(caret.position == null ? null : editor.offsetToLogicalPosition(caret.getCaretOffset(editor.getDocument()))); + selections.add(caret.selection == null ? null : caret.selection); + } + caretModel.setCaretsAndSelections(caretPositions, selections); } - if (result.carets.isEmpty()) { - result.carets.add(new Caret(null, null)); + else { + assertEquals("Multiple carets are not supported by the model", 1, caretsState.carets.size()); + CaretInfo caret = caretsState.carets.get(0); + if (caret.position != null) { + caretModel.moveToOffset(caret.getCaretOffset(editor.getDocument())); + } + if (caret.selection != null) { + editor.getSelectionModel().setSelection(caret.selection.getStartOffset(), caret.selection.getEndOffset()); + } } - if (blockSelectionStartMarker != null) { - result.blockSelection = new TextRange(blockSelectionStartMarker.getStartOffset(), blockSelectionEndMarker.getStartOffset()); + if (caretsState.blockSelection != null) { + editor.getSelectionModel().setBlockSelection(editor.offsetToLogicalPosition(caretsState.blockSelection.getStartOffset()), + editor.offsetToLogicalPosition(caretsState.blockSelection.getEndOffset())); } + } - return result; + public static void verifyCaretAndSelectionState(Editor editor, CaretAndSelectionState caretState) { + verifyCaretAndSelectionState(editor, caretState, null); } - public static void verifyCaretAndSelectionState(Editor editor, CaretsState caretState) { + public static void verifyCaretAndSelectionState(Editor editor, CaretAndSelectionState caretState, String message) { + boolean hasChecks = false; + for (int i = 0; i < caretState.carets.size(); i++) { + EditorTestUtil.CaretInfo expected = caretState.carets.get(i); + if (expected.position != null || expected.selection != null) { + hasChecks = true; + break; + } + } + if (!hasChecks) { + return; // nothing to check, so we skip caret/selection assertions + } + String messageSuffix = message == null ? "" : (message + ": "); CaretModel caretModel = editor.getCaretModel(); - List<com.intellij.openapi.editor.Caret> allCarets = new ArrayList<com.intellij.openapi.editor.Caret>(caretModel.getAllCarets()); - assertEquals("Unexpected number of carets", caretState.carets.size(), allCarets.size()); + List<Caret> allCarets = new ArrayList<Caret>(caretModel.getAllCarets()); + assertEquals(messageSuffix + " Unexpected number of carets", caretState.carets.size(), allCarets.size()); for (int i = 0; i < caretState.carets.size(); i++) { String caretDescription = caretState.carets.size() == 1 ? "" : "caret " + (i + 1) + "/" + caretState.carets.size() + " "; - com.intellij.openapi.editor.Caret currentCaret = allCarets.get(i); - LogicalPosition actualCaretPosition = currentCaret.getLogicalPosition(); - LogicalPosition actualSelectionStart = editor.offsetToLogicalPosition(currentCaret.getSelectionStart()); - LogicalPosition actualSelectionEnd = editor.offsetToLogicalPosition(currentCaret.getSelectionEnd()); - EditorTestUtil.Caret expected = caretState.carets.get(i); - if (expected.offset != null) { - LogicalPosition expectedCaretPosition = editor.offsetToLogicalPosition(expected.offset); - assertEquals(caretDescription + "unexpected caret position", expectedCaretPosition, actualCaretPosition); + Caret currentCaret = allCarets.get(i); + int actualCaretLine = editor.getDocument().getLineNumber(currentCaret.getOffset()); + int actualCaretColumn = currentCaret.getOffset() - editor.getDocument().getLineStartOffset(actualCaretLine); + LogicalPosition actualCaretPosition = new LogicalPosition(actualCaretLine, actualCaretColumn); + int[] selectionStarts = editor.getSelectionModel().getBlockSelectionStarts(); + int[] selectionEnds = editor.getSelectionModel().getBlockSelectionEnds(); + int selectionStart = editor.getSelectionModel().hasBlockSelection() ? selectionStarts[selectionStarts.length - 1] : currentCaret.getSelectionStart(); + int selectionEnd = editor.getSelectionModel().hasBlockSelection() ? selectionEnds[selectionEnds.length - 1] : currentCaret.getSelectionEnd(); + LogicalPosition actualSelectionStart = editor.offsetToLogicalPosition(selectionStart); + LogicalPosition actualSelectionEnd = editor.offsetToLogicalPosition(selectionEnd); + CaretInfo expected = caretState.carets.get(i); + if (expected.position != null) { + assertEquals(messageSuffix + caretDescription + "unexpected caret position", expected.position, actualCaretPosition); } if (expected.selection != null) { LogicalPosition expectedSelectionStart = editor.offsetToLogicalPosition(expected.selection.getStartOffset()); LogicalPosition expectedSelectionEnd = editor.offsetToLogicalPosition(expected.selection.getEndOffset()); - assertEquals(caretDescription + "unexpected selection start", expectedSelectionStart, actualSelectionStart); - assertEquals(caretDescription + "unexpected selection end", expectedSelectionEnd, actualSelectionEnd); + assertEquals(messageSuffix + caretDescription + "unexpected selection start", expectedSelectionStart, actualSelectionStart); + assertEquals(messageSuffix + caretDescription + "unexpected selection end", expectedSelectionEnd, actualSelectionEnd); } else { - assertFalse(caretDescription + "should has no selection, but was: (" + actualSelectionStart + ", " + actualSelectionEnd + ")", + assertFalse(messageSuffix + caretDescription + "should has no selection, but was: (" + actualSelectionStart + ", " + actualSelectionEnd + ")", currentCaret.hasSelection()); } } @@ -322,22 +391,27 @@ public class EditorTestUtil { Registry.get("editor.allow.multiple.carets").setValue(false); } - public static class CaretsState { - @NotNull - public final List<Caret> carets = new ArrayList<Caret>(); + public static class CaretAndSelectionState { + public final List<CaretInfo> carets = new ArrayList<CaretInfo>(); @Nullable public TextRange blockSelection; } - public static class Caret { + public static class CaretInfo { @Nullable - public final Integer offset; + public final LogicalPosition position; // column number in this position is calculated in terms of characters, + // not in terms of visual position + // so Tab character always increases the column number by 1 @Nullable public final TextRange selection; - public Caret(Integer offset, TextRange selection) { - this.offset = offset; + public CaretInfo(@Nullable LogicalPosition position, @Nullable TextRange selection) { + this.position = position; this.selection = selection; } + + public int getCaretOffset(Document document) { + return document.getLineStartOffset(position.line) + position.column; + } } } diff --git a/platform/testFramework/src/com/intellij/testFramework/IdeResourcesTestCase.java b/platform/testFramework/src/com/intellij/testFramework/IdeResourcesTestCase.java new file mode 100644 index 000000000000..683eb9a3da82 --- /dev/null +++ b/platform/testFramework/src/com/intellij/testFramework/IdeResourcesTestCase.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.testFramework; + +import com.intellij.featureStatistics.FeatureDescriptor; +import com.intellij.featureStatistics.ProductivityFeaturesRegistry; +import com.intellij.ide.util.TipAndTrickBean; +import com.intellij.openapi.util.text.StringUtil; +import com.intellij.util.ResourceUtil; +import com.intellij.util.containers.ContainerUtil; + +import java.net.URL; +import java.util.Arrays; +import java.util.List; +import java.util.Set; + +/** + * This test-case should be extended in every IDE. + * + * @author gregsh + */ +public abstract class IdeResourcesTestCase extends PlatformTestCase { + + @Override + protected boolean isRunInWriteAction() { + return false; + } + + public void testFeatureTipsRegistered() { + ProductivityFeaturesRegistry registry = ProductivityFeaturesRegistry.getInstance(); + Set<String> ids = registry.getFeatureIds(); + assertNotEmpty(ids); + + List<String> errors = ContainerUtil.newArrayList(); + for (String id : ids) { + FeatureDescriptor descriptor = registry.getFeatureDescriptor(id); + TipAndTrickBean tip = TipAndTrickBean.findByFileName(descriptor.getTipFileName()); + if (tip == null) { + errors.add("<tipAndTrick file=\"" + descriptor.getTipFileName() + "\" feature-id=\"" + id + "\"/>"); + } + } + assertEquals("Register the following extensions:\n" + StringUtil.join(errors, "\n"), 0, errors.size()); + } + + public void testTipFilesPresent() { + List<String> errors = ContainerUtil.newArrayList(); + TipAndTrickBean[] tips = TipAndTrickBean.EP_NAME.getExtensions(); + assertNotEmpty(Arrays.asList(tips)); + for (TipAndTrickBean tip : tips) { + URL url = ResourceUtil.getResource(tip.getPluginDescriptor().getPluginClassLoader(), "/tips/", tip.fileName); + if (url == null) { + errors.add(tip.fileName); + } + } + assertEquals(tips.length + " tips are checked, the following files are missing:\n" + StringUtil.join(errors, "\n"), 0, errors.size()); + } + + public void testTipFilesDuplicates() { + List<String> errors = ContainerUtil.newArrayList(); + TipAndTrickBean[] tips = TipAndTrickBean.EP_NAME.getExtensions(); + assertNotEmpty(Arrays.asList(tips)); + Set<String> visited = ContainerUtil.newLinkedHashSet(); + for (TipAndTrickBean tip : tips) { + if (!visited.add(tip.fileName)) { + errors.add(tip.fileName); + } + } + assertEquals("The following tip files are registered more than once:\n" + StringUtil.join(errors, "\n"), 0, errors.size()); + } +} diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java index e0e8e3d2b656..f3fd0446ef93 100644 --- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java @@ -39,9 +39,7 @@ import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.fileEditor.impl.TrailingSpacesStripper; -import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.ProjectManager; -import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.io.FileUtilRt; import com.intellij.openapi.util.text.StringUtil; @@ -52,7 +50,6 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.encoding.EncodingProjectManager; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiFile; -import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil; import com.intellij.rt.execution.junit.FileComparisonFailure; @@ -175,7 +172,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest } final Document fakeDocument = new DocumentImpl(fileText); - EditorTestUtil.CaretsState caretsState = EditorTestUtil.extractCaretAndSelectionMarkers(fakeDocument); + EditorTestUtil.CaretAndSelectionState caretsState = EditorTestUtil.extractCaretAndSelectionMarkers(fakeDocument); String newFileText = fakeDocument.getText(); Document document; @@ -185,49 +182,13 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest catch (IOException e) { throw new RuntimeException(e); } - setupCaretAndSelection(caretsState, newFileText); + EditorTestUtil.setCaretsAndSelection(myEditor, caretsState); setupEditorForInjectedLanguage(); result.setResult(document); } }.execute().getResultObject(); } - private static void setupCaretAndSelection(EditorTestUtil.CaretsState caretsState, String fileText) { - List<EditorTestUtil.Caret> carets = caretsState.carets; - if (myEditor.getCaretModel().supportsMultipleCarets()) { - List<LogicalPosition> caretPositions = new ArrayList<LogicalPosition>(); - List<Segment> selections = new ArrayList<Segment>(); - for (EditorTestUtil.Caret caret : carets) { - LogicalPosition pos = null; - if (caret.offset != null) { - int caretLine = StringUtil.offsetToLineNumber(fileText, caret.offset); - int caretCol = EditorUtil.calcColumnNumber(null, myEditor.getDocument().getText(), - myEditor.getDocument().getLineStartOffset(caretLine), caret.offset, - CodeStyleSettingsManager.getSettings(getProject()).getIndentOptions(StdFileTypes.JAVA).TAB_SIZE); - pos = new LogicalPosition(caretLine, caretCol); - } - caretPositions.add(pos); - selections.add(caret.selection == null ? null : caret.selection); - } - myEditor.getCaretModel().setCarets(caretPositions, selections); - } - else { - assertEquals("Caret model doesn't support multiple carets", 1, carets.size()); - EditorTestUtil.Caret caret = carets.get(0); - if (caret.offset != null) { - int caretLine = StringUtil.offsetToLineNumber(fileText, caret.offset); - int caretCol = EditorUtil.calcColumnNumber(null, myEditor.getDocument().getText(), - myEditor.getDocument().getLineStartOffset(caretLine), caret.offset, - CodeStyleSettingsManager.getSettings(getProject()).getIndentOptions(StdFileTypes.JAVA).TAB_SIZE); - LogicalPosition pos = new LogicalPosition(caretLine, caretCol); - myEditor.getCaretModel().moveToLogicalPosition(pos); - } - if (caret.selection != null) { - myEditor.getSelectionModel().setSelection(caret.selection.getStartOffset(), caret.selection.getEndOffset()); - } - } - } - protected static Editor createEditor(@NotNull VirtualFile file) { Editor editor = FileEditorManager.getInstance(getProject()).openTextEditor(new OpenFileDescriptor(getProject(), file, 0), false); ((EditorImpl)editor).setCaretActive(); @@ -345,14 +306,14 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest } /** - * Same as checkResultByFile but text is provided directly. - * @param message - this check specific message. Added to text, caret position, selection checking. May be null - * @param ignoreTrailingSpaces - whether trailing spaces in editor in data file should be stripped prior to comparing. - */ + * Same as checkResultByFile but text is provided directly. + * @param message - this check specific message. Added to text, caret position, selection checking. May be null + * @param ignoreTrailingSpaces - whether trailing spaces in editor in data file should be stripped prior to comparing. + */ protected void checkResultByText(final String message, @NotNull String fileText, final boolean ignoreTrailingSpaces) { - checkResultByText(message, fileText, ignoreTrailingSpaces, null); + checkResultByText(message, fileText, ignoreTrailingSpaces, null); } - + /** * Same as checkResultByFile but text is provided directly. * @param message - this check specific message. Added to text, caret position, selection checking. May be null @@ -370,7 +331,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest ((DocumentImpl)document).stripTrailingSpaces(getProject()); } - EditorTestUtil.CaretsState carets = EditorTestUtil.extractCaretAndSelectionMarkers(document); + EditorTestUtil.CaretAndSelectionState carets = EditorTestUtil.extractCaretAndSelectionMarkers(document); PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting(); String newFileText = document.getText(); @@ -383,7 +344,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest } assertEquals(failMessage, newFileText, fileText); - checkCaretAndSelectionPositions(carets, newFileText, message); + EditorTestUtil.verifyCaretAndSelectionState(myEditor, carets, message); } }); } @@ -393,63 +354,6 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest return userMessage + " [" + engineMessage + "]"; } - private static String getCaretDescription(int caretNumber, int totalCarets) { - return totalCarets == 1 ? "" : "(caret " + (caretNumber + 1) + "/" + totalCarets + ")"; - } - - @SuppressWarnings("ConstantConditions") - private static void checkCaretAndSelectionPositions(EditorTestUtil.CaretsState caretState, String newFileText, String message) { - CaretModel caretModel = myEditor.getCaretModel(); - List<Caret> allCarets = new ArrayList<Caret>(caretModel.getAllCarets()); - assertEquals("Unexpected number of carets", caretState.carets.size(), allCarets.size()); - for (int i = 0; i < caretState.carets.size(); i++) { - String caretDescription = getCaretDescription(i, caretState.carets.size()); - Caret currentCaret = allCarets.get(i); - LogicalPosition actualCaretPosition = currentCaret.getLogicalPosition(); - EditorTestUtil.Caret expected = caretState.carets.get(i); - if (expected.offset != null) { - int caretLine = StringUtil.offsetToLineNumber(newFileText, expected.offset); - int caretCol = EditorUtil.calcColumnNumber(null, newFileText, - StringUtil.lineColToOffset(newFileText, caretLine, 0), - expected.offset, - CodeStyleSettingsManager.getSettings(getProject()).getIndentOptions(StdFileTypes.JAVA).TAB_SIZE); - - assertEquals(getMessage("caretLine" + caretDescription, message), caretLine + 1, actualCaretPosition.line + 1); - assertEquals(getMessage("caretColumn" + caretDescription, message), caretCol + 1, actualCaretPosition.column + 1); - } - if (expected.selection != null) { - int selStartLine = StringUtil.offsetToLineNumber(newFileText, expected.selection.getStartOffset()); - int selStartCol = expected.selection.getStartOffset() - StringUtil.lineColToOffset(newFileText, selStartLine, 0); - - int selEndLine = StringUtil.offsetToLineNumber(newFileText, expected.selection.getEndOffset()); - int selEndCol = expected.selection.getEndOffset() - StringUtil.lineColToOffset(newFileText, selEndLine, 0); - - assertEquals( - getMessage("selectionStartLine" + caretDescription, message), - selStartLine + 1, - StringUtil.offsetToLineNumber(newFileText, currentCaret.getSelectionStart()) + 1); - - assertEquals( - getMessage("selectionStartCol" + caretDescription, message), - selStartCol + 1, - currentCaret.getSelectionStart() - StringUtil.lineColToOffset(newFileText, selStartLine, 0) + 1); - - assertEquals( - getMessage("selectionEndLine" + caretDescription, message), - selEndLine + 1, - StringUtil.offsetToLineNumber(newFileText, currentCaret.getSelectionEnd()) + 1); - - assertEquals( - getMessage("selectionEndCol" + caretDescription, message), - selEndCol + 1, - currentCaret.getSelectionEnd() - StringUtil.lineColToOffset(newFileText, selEndLine, 0) + 1); - } - else { - assertFalse(getMessage("must not have selection" + caretDescription, message), currentCaret.hasSelection()); - } - } - } - @Override public Object getData(String dataId) { if (CommonDataKeys.EDITOR.is(dataId)) { @@ -547,7 +451,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest protected static void paste() { executeAction(IdeActions.ACTION_EDITOR_PASTE); } - + protected static void moveCaretToPreviousWordWithSelection() { executeAction("EditorPreviousWordWithSelection"); } @@ -559,7 +463,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest protected static void cutLineBackward() { executeAction("EditorCutLineBackward"); } - + protected static void cutToLineEnd() { executeAction("EditorCutLineEnd"); } @@ -567,7 +471,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest protected static void killToWordStart() { executeAction("EditorKillToWordStart"); } - + protected static void killToWordEnd() { executeAction("EditorKillToWordEnd"); } @@ -591,7 +495,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest protected static void lineComment() { new CommentByLineCommentHandler().invoke(getProject(), getEditor(), getFile()); } - + protected static void executeAction(@NonNls @NotNull final String actionId) { CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() { @Override @@ -636,14 +540,14 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest */ /** - * @Parameterized.Parameter fields are injected on parameterized test creation. + * @Parameterized.Parameter fields are injected on parameterized test creation. */ @Parameterized.Parameter(0) public String myFileSuffix; /** - * path to the root of test data in case of com.intellij.testFramework.FileBasedTestCaseHelperEx - * or + * path to the root of test data in case of com.intellij.testFramework.FileBasedTestCaseHelperEx + * or * path to the directory with current test data in case of @TestDataPath */ @Parameterized.Parameter(1) @@ -697,7 +601,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest } return result; } - + @Override public String getName() { if (myFileSuffix != null) { @@ -747,4 +651,27 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest } } + protected void runSingleTest(final Runnable testRunnable) throws Throwable { + final Throwable[] throwables = new Throwable[1]; + + Runnable runnable = new Runnable() { + @Override + public void run() { + try { + testRunnable.run(); + } + catch (Throwable e) { + throwables[0] = e; + } + } + }; + + invokeTestRunnable(runnable); + + if (throwables[0] != null) { + throw throwables[0]; + } + + } + } diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 26c9c896512e..afecf29f1168 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.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. @@ -89,6 +89,9 @@ public class PlatformTestUtil { public static final boolean COVERAGE_ENABLED_BUILD = "true".equals(System.getProperty("idea.coverage.enabled.build")); public static final byte[] EMPTY_JAR_BYTES = {0x50, 0x4b, 0x05, 0x06, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; + private static final boolean SKIP_HEADLESS = GraphicsEnvironment.isHeadless(); + private static final boolean SKIP_SLOW = Boolean.getBoolean("skip.slow.tests.locally"); + public static <T> void registerExtension(final ExtensionPointName<T> name, final T t, final Disposable parentDisposable) { registerExtension(Extensions.getRootArea(), name, t, parentDisposable); } @@ -419,14 +422,21 @@ public class PlatformTestUtil { } public static boolean canRunTest(@NotNull Class testCaseClass) { - if (GraphicsEnvironment.isHeadless()) { - for (Class<?> clazz = testCaseClass; clazz != null; clazz = clazz.getSuperclass()) { - if (clazz.getAnnotation(SkipInHeadlessEnvironment.class) != null) { - System.out.println("Class '" + testCaseClass.getName() + "' is skipped because it requires working UI environment"); - return false; - } + if (!SKIP_SLOW && !SKIP_HEADLESS) { + return true; + } + + for (Class<?> clazz = testCaseClass; clazz != null; clazz = clazz.getSuperclass()) { + if (SKIP_HEADLESS && clazz.getAnnotation(SkipInHeadlessEnvironment.class) != null) { + System.out.println("Class '" + testCaseClass.getName() + "' is skipped because it requires working UI environment"); + return false; + } + if (SKIP_SLOW && clazz.getAnnotation(SkipSlowTestLocally.class) != null) { + System.out.println("Class '" + testCaseClass.getName() + "' is skipped because it is dog slow"); + return false; } } + return true; } diff --git a/platform/testFramework/src/com/intellij/testFramework/SkipSlowTestLocally.java b/platform/testFramework/src/com/intellij/testFramework/SkipSlowTestLocally.java new file mode 100644 index 000000000000..80768b5fad93 --- /dev/null +++ b/platform/testFramework/src/com/intellij/testFramework/SkipSlowTestLocally.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.testFramework; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Mark dog slow {@link com.intellij.testFramework.UsefulTestCase} implementations for skip in local test pass + * if "skip.slow.tests.locally" property is defined. + */ +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface SkipSlowTestLocally { } diff --git a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java index d7e6e5a42ec4..785c587f488f 100644 --- a/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/UsefulTestCase.java @@ -22,7 +22,6 @@ import com.intellij.openapi.Disposable; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.impl.StartMarkAction; import com.intellij.openapi.editor.impl.DocumentImpl; import com.intellij.openapi.fileTypes.StdFileTypes; @@ -43,10 +42,7 @@ import com.intellij.psi.impl.source.PostprocessReformattingAspect; import com.intellij.refactoring.rename.inplace.InplaceRefactoring; import com.intellij.rt.execution.junit.FileComparisonFailure; import com.intellij.testFramework.exceptionCases.AbstractExceptionCase; -import com.intellij.util.Consumer; -import com.intellij.util.Function; -import com.intellij.util.Processor; -import com.intellij.util.ReflectionUtil; +import com.intellij.util.*; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.UIUtil; import gnu.trove.THashSet; @@ -750,16 +746,11 @@ public abstract class UsefulTestCase extends TestCase { } public static void doPostponedFormatting(final Project project) { - CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + DocumentUtil.writeInRunUndoTransparentAction(new Runnable() { @Override public void run() { - ApplicationManager.getApplication().runWriteAction(new Runnable() { - @Override - public void run() { - PsiDocumentManager.getInstance(project).commitAllDocuments(); - PostprocessReformattingAspect.getInstance(project).doPostponedFormatting(); - } - }); + PsiDocumentManager.getInstance(project).commitAllDocuments(); + PostprocessReformattingAspect.getInstance(project).doPostponedFormatting(); } }); } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/EditorMouseFixture.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/EditorMouseFixture.java index 12fbf700d4ce..0c625d7e1ce3 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/EditorMouseFixture.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/EditorMouseFixture.java @@ -15,11 +15,11 @@ */ package com.intellij.testFramework.fixtures; -import com.intellij.openapi.editor.ex.util.EditorUtil; +import com.intellij.openapi.editor.VisualPosition; import com.intellij.openapi.editor.impl.EditorImpl; import javax.swing.JComponent; -import java.awt.Font; +import java.awt.*; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; @@ -38,12 +38,13 @@ public class EditorMouseFixture { public EditorMouseFixture pressAt(int visualLine, int visualColumn) { JComponent component = myEditor.getContentComponent(); + Point p = getPoint(visualLine, visualColumn); component.dispatchEvent(new MouseEvent(component, myLastId = MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), getModifiers(), - myX = getX(visualColumn), - myY = getY(visualLine), + myX = p.x, + myY = p.y, 1, false, myButton)); @@ -82,12 +83,13 @@ public class EditorMouseFixture { public EditorMouseFixture dragTo(int visualLine, int visualColumn) { JComponent component = myEditor.getContentComponent(); + Point p = getPoint(visualLine, visualColumn); component.dispatchEvent(new MouseEvent(component, myLastId = MouseEvent.MOUSE_DRAGGED, System.currentTimeMillis(), getModifiers(), - myX = getX(visualColumn), - myY = getY(visualLine), + myX = p.x, + myY = p.y, 1, false, myButton)); @@ -109,12 +111,8 @@ public class EditorMouseFixture { return this; } - private int getX(int visualColumn) { - return visualColumn * EditorUtil.getSpaceWidth(Font.PLAIN, myEditor); - } - - private int getY(int visualLine) { - return visualLine * myEditor.getLineHeight(); + private Point getPoint(int visualLine, int visualColumn) { + return myEditor.visualPositionToXY(new VisualPosition(visualLine, visualColumn)); } private int getModifiers() { diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/LightPlatformCodeInsightFixtureTestCase.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/LightPlatformCodeInsightFixtureTestCase.java index fb027f186bcf..47205a51c42f 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/LightPlatformCodeInsightFixtureTestCase.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/LightPlatformCodeInsightFixtureTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 82a3ad68c25e..92e4a19d6163 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -74,7 +74,6 @@ import com.intellij.openapi.fileEditor.*; import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeManager; -import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.module.Module; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.project.DumbService; @@ -86,7 +85,6 @@ import com.intellij.openapi.vfs.*; import com.intellij.profile.codeInspection.InspectionProfileManager; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; import com.intellij.psi.*; -import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.intellij.psi.impl.DebugUtil; import com.intellij.psi.impl.PsiManagerImpl; import com.intellij.psi.impl.PsiModificationTrackerImpl; @@ -123,10 +121,6 @@ import java.io.File; import java.io.IOException; import java.util.*; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - /** * @author Dmitry Avdeev */ @@ -1054,7 +1048,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig protected void run(Result result) throws Throwable { PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); EditorUtil.fillVirtualSpaceUntilCaret(myEditor); - checkResult("TEXT", stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromText(text, getProject()), getHostFile().getText()); + checkResult("TEXT", stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromText(text), getHostFile().getText()); } }.execute(); } @@ -1307,7 +1301,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig } VfsUtil.saveText(vFile, text); - configureInner(vFile, SelectionAndCaretMarkupLoader.fromFile(vFile, getProject())); + configureInner(vFile, SelectionAndCaretMarkupLoader.fromFile(vFile)); } }.execute(); return myFile; @@ -1340,7 +1334,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig } private PsiFile configureByFileInner(final VirtualFile copy) { - return configureInner(copy, SelectionAndCaretMarkupLoader.fromFile(copy, getProject())); + return configureInner(copy, SelectionAndCaretMarkupLoader.fromFile(copy)); } private PsiFile configureInner(@NotNull final VirtualFile copy, final SelectionAndCaretMarkupLoader loader) { @@ -1360,32 +1354,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig copy.getPath() + ", use copyFileToProject(..) method for this file instead of configureByFile(..)"; - if (myEditor.getCaretModel().supportsMultipleCarets()) { - List<LogicalPosition> caretPositions = new ArrayList<LogicalPosition>(); - List<Segment> selections = new ArrayList<Segment>(); - for (EditorTestUtil.Caret caret : loader.caretState.carets) { - caretPositions.add(caret.offset == null ? null : myEditor.offsetToLogicalPosition(caret.offset)); - selections.add(caret.selection == null ? null : caret.selection); - } - myEditor.getCaretModel().setCarets(caretPositions, selections); - } - else { - assert loader.caretState.carets.size() == 1 : "Multiple carets are not supported by the model"; - EditorTestUtil.Caret caret = loader.caretState.carets.get(0); - int offset = caret.offset != null ? caret.offset : 0; - myEditor.getCaretModel().moveToOffset(offset); - - if (caret.selection != null) { - myEditor.getSelectionModel().setSelection(caret.selection.getStartOffset(), caret.selection.getEndOffset()); - } - else { - myEditor.getSelectionModel().removeSelection(); - } - } - if (loader.caretState.blockSelection != null) { - myEditor.getSelectionModel().setBlockSelection(myEditor.offsetToLogicalPosition(loader.caretState.blockSelection.getStartOffset()), - myEditor.offsetToLogicalPosition(loader.caretState.blockSelection.getEndOffset())); - } + EditorTestUtil.setCaretsAndSelection(myEditor, loader.caretState); Module module = getModule(); if (module != null) { @@ -1647,14 +1616,13 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig static class SelectionAndCaretMarkupLoader { final String filePath; final String newFileText; - final EditorTestUtil.CaretsState caretState; + final EditorTestUtil.CaretAndSelectionState caretState; - static SelectionAndCaretMarkupLoader fromFile(String path, Project project, String charset) throws IOException { - return new SelectionAndCaretMarkupLoader( - project, StringUtil.convertLineSeparators(FileUtil.loadFile(new File(path), charset)), path); + static SelectionAndCaretMarkupLoader fromFile(String path, String charset) throws IOException { + return new SelectionAndCaretMarkupLoader(StringUtil.convertLineSeparators(FileUtil.loadFile(new File(path), charset)), path); } - static SelectionAndCaretMarkupLoader fromFile(VirtualFile file, Project project) { + static SelectionAndCaretMarkupLoader fromFile(VirtualFile file) { final String text; try { text = VfsUtilCore.loadText(file); @@ -1662,24 +1630,17 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig catch (IOException e) { throw new RuntimeException(e); } - return new SelectionAndCaretMarkupLoader(project, StringUtil.convertLineSeparators(text), file.getPath()); + return new SelectionAndCaretMarkupLoader(StringUtil.convertLineSeparators(text), file.getPath()); } - static SelectionAndCaretMarkupLoader fromText(String text, Project project) { - return new SelectionAndCaretMarkupLoader(project, text, null); + static SelectionAndCaretMarkupLoader fromText(String text) { + return new SelectionAndCaretMarkupLoader(text, null); } - private SelectionAndCaretMarkupLoader(Project project, String fileText, String filePath) { + private SelectionAndCaretMarkupLoader(String fileText, String filePath) { this.filePath = filePath; final Document document = EditorFactory.getInstance().createDocument(fileText); - - caretState = new WriteCommandAction<EditorTestUtil.CaretsState>(project) { - @Override - protected void run(@NotNull Result<EditorTestUtil.CaretsState> result) throws Exception { - result.setResult(EditorTestUtil.extractCaretAndSelectionMarkers(document)); - } - }.execute().getResultObject(); - + caretState = EditorTestUtil.extractCaretAndSelectionMarkers(document); newFileText = document.getText(); } } @@ -1702,7 +1663,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig VirtualFile virtualFile = originalFile.getVirtualFile(); String charset = virtualFile == null? null : virtualFile.getCharset().name(); - checkResult(expectedFile, stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromFile(path, getProject(), charset), fileText); + checkResult(expectedFile, stripTrailingSpaces, SelectionAndCaretMarkupLoader.fromFile(path, charset), fileText); } @@ -1743,89 +1704,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig } } - boolean hasChecks = false; - for (int i = 0; i < loader.caretState.carets.size(); i++) { - EditorTestUtil.Caret expected = loader.caretState.carets.get(i); - if (expected.offset != null || expected.selection != null) { - hasChecks = true; - break; - } - } - if (!hasChecks) { - return; // nothing to check, so we skip caret/selection assertions - } - CaretModel caretModel = editor.getCaretModel(); - List<Caret> allCarets = new ArrayList<Caret>(caretModel.getAllCarets()); - assertEquals("Unexpected number of carets", loader.caretState.carets.size(), allCarets.size()); - for (int i = 0; i < loader.caretState.carets.size(); i++) { - EditorTestUtil.Caret expected = loader.caretState.carets.get(i); - String caretDescription = loader.caretState.carets.size() == 1 ? "" : "(" + (i + 1) + "/" + loader.caretState.carets.size() + ") "; - if (expected.offset != null) { - final int tabSize = CodeStyleSettingsManager.getSettings(getProject()).getIndentOptions(StdFileTypes.JAVA).TAB_SIZE; - - int caretLine = StringUtil.offsetToLineNumber(loader.newFileText, expected.offset); - int caretCol = EditorUtil.calcColumnNumber(null, loader.newFileText, StringUtil.lineColToOffset(loader.newFileText, caretLine, 0), expected.offset, tabSize); - - final int actualLine = allCarets.get(i).getLogicalPosition().line; - final int actualCol = allCarets.get(i).getLogicalPosition().column; - boolean caretPositionEquals = caretLine == actualLine && caretCol == actualCol; - assertTrue("Caret" + caretDescription + " position in " + expectedFile + " differs. Expected " + genCaretPositionPresentation(caretLine, caretCol) - + ". Actual " + genCaretPositionPresentation(actualLine, actualCol), caretPositionEquals); - } - - if (expected.selection != null) { - int selStartLine = StringUtil.offsetToLineNumber(loader.newFileText, expected.selection.getStartOffset()); - int selStartCol = expected.selection.getStartOffset() - StringUtil.lineColToOffset(loader.newFileText, selStartLine, 0); - - int selEndLine = StringUtil.offsetToLineNumber(loader.newFileText, expected.selection.getEndOffset()); - int selEndCol = expected.selection.getEndOffset() - StringUtil.lineColToOffset(loader.newFileText, selEndLine, 0); - - int selectionStart; - int selectionEnd; - if (editor.getSelectionModel().hasBlockSelection()) { - int[] starts = editor.getSelectionModel().getBlockSelectionStarts(); - int[] ends = editor.getSelectionModel().getBlockSelectionEnds(); - selectionStart = starts[starts.length-1]; - selectionEnd = ends[ends.length-1]; - } - else { - selectionStart = allCarets.get(i).getSelectionStart(); - selectionEnd = allCarets.get(i).getSelectionEnd(); - } - - final int selStartLineActual = StringUtil.offsetToLineNumber(loader.newFileText, selectionStart); - final int selStartColActual = selectionStart - StringUtil.lineColToOffset(loader.newFileText, selStartLineActual, 0); - - final int selEndLineActual = StringUtil.offsetToLineNumber(loader.newFileText, selectionEnd); - final int selEndColActual = selectionEnd - StringUtil.lineColToOffset(loader.newFileText, selEndLineActual, 0); - - final boolean selectionEquals = selStartCol == selStartColActual && - selStartLine == selStartLineActual && - selEndCol == selEndColActual && - selEndLine == selEndLineActual; - assertTrue(caretDescription + "selection in " + expectedFile + " differs. Expected " + genSelectionPresentation(selStartLine, selStartCol, selEndLine, selEndCol) + - ". Actual " + genSelectionPresentation(selStartLineActual, selStartColActual, selEndLineActual, selEndColActual), - selectionEquals - ); - } - else if (editor != null) { - assertFalse(caretDescription + "has no selection in " + expectedFile, editor.getSelectionModel().hasSelection()); - } - } - } - - private static String genCaretPositionPresentation(int line, int col) { - line++; - col++; - return "(" + line + ", " + col + ")"; - } - - private static String genSelectionPresentation(int startLine, int startCol, int endLine, int endCol) { - startCol++; - startLine++; - endCol++; - endLine++; - return "(" + startLine + ", " + startCol + ")-(" + endLine + ", " + endCol + ")"; + EditorTestUtil.verifyCaretAndSelectionState(editor, loader.caretState); } private String stripTrailingSpaces(String actualText) { diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java index 25ef683725d8..d6edbbb655bc 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java @@ -238,14 +238,15 @@ class UsageViewTreeCellRenderer extends ColoredTreeCellRenderer { public RowLocation isRowVisible(int row, @NotNull Rectangle visibleRect) { Dimension pref; if (cachedPreferredSize == null) { - pref = cachedPreferredSize = getPreferredSize(); + cachedPreferredSize = pref = getPreferredSize(); } else { pref = cachedPreferredSize; } pref.width = Math.max(visibleRect.width, pref.width); myRowBoundsCalled = true; - final Rectangle bounds = getTree().getRowBounds(row); + JTree tree = getTree(); + final Rectangle bounds = tree == null ? null : tree.getRowBounds(row); myRowBoundsCalled = false; int y = bounds == null ? 0 : bounds.y; TextRange vis = TextRange.from(Math.max(0, visibleRect.y - pref.height), visibleRect.height + pref.height * 2); diff --git a/platform/util-rt/src/com/intellij/openapi/util/Comparing.java b/platform/util-rt/src/com/intellij/openapi/util/Comparing.java index 7efc489dfc11..6813404f0539 100644 --- a/platform/util-rt/src/com/intellij/openapi/util/Comparing.java +++ b/platform/util-rt/src/com/intellij/openapi/util/Comparing.java @@ -90,7 +90,7 @@ public class Comparing { } } - public static boolean strEqual(String arg1, String arg2){ + public static boolean strEqual(@Nullable String arg1, @Nullable String arg2){ return strEqual(arg1, arg2, true); } diff --git a/platform/util/src/com/intellij/openapi/diff/impl/highlighting/List2D.java b/platform/util/src/com/intellij/openapi/diff/impl/highlighting/List2D.java index f57d127fdb84..0a6d905b0d37 100644 --- a/platform/util/src/com/intellij/openapi/diff/impl/highlighting/List2D.java +++ b/platform/util/src/com/intellij/openapi/diff/impl/highlighting/List2D.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.List; class List2D { - private final ArrayList<List> myRows = new ArrayList<List>(); - private ArrayList myCurrentRow = null; + private final List<List<DiffFragment>> myRows = new ArrayList<List<DiffFragment>>(); + private List<DiffFragment> myCurrentRow = null; public void add(DiffFragment element) { ensureRowExists(); @@ -31,7 +31,7 @@ class List2D { private void ensureRowExists() { if (myCurrentRow == null) { - myCurrentRow = new ArrayList(); + myCurrentRow = new ArrayList<DiffFragment>(); myRows.add(myCurrentRow); } } @@ -45,7 +45,7 @@ class List2D { DiffFragment[][] result = new DiffFragment[myRows.size()][]; for (int i = 0; i < result.length; i++) { - List row = myRows.get(i); + List<DiffFragment> row = myRows.get(i); result[i] = new DiffFragment[row.size()]; System.arraycopy(row.toArray(), 0, result[i], 0, row.size()); } diff --git a/platform/util/src/com/intellij/openapi/diff/impl/processing/DummyDiffFragmentsProcessor.java b/platform/util/src/com/intellij/openapi/diff/impl/processing/DummyDiffFragmentsProcessor.java index 10753bbec21e..8da7510145b8 100644 --- a/platform/util/src/com/intellij/openapi/diff/impl/processing/DummyDiffFragmentsProcessor.java +++ b/platform/util/src/com/intellij/openapi/diff/impl/processing/DummyDiffFragmentsProcessor.java @@ -26,11 +26,12 @@ public class DummyDiffFragmentsProcessor { public ArrayList<LineFragment> process(String text1, String text2) { ArrayList<LineFragment> lineFragments = new ArrayList<LineFragment>(); - TextDiffTypeEnum type; if (text1.isEmpty() && text2.isEmpty()) { - type = TextDiffTypeEnum.NONE; + return lineFragments; } - else if (text1.isEmpty()) { + + TextDiffTypeEnum type; + if (text1.isEmpty()) { type = TextDiffTypeEnum.INSERT; } else if (text2.isEmpty()) { diff --git a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java index 41feba6d1584..4db826f55837 100644 --- a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java +++ b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java @@ -15,6 +15,7 @@ */ package com.intellij.openapi.util; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -32,35 +33,38 @@ public class MultiValuesMap<K, V>{ myBaseMap = ordered ? new LinkedHashMap<K, Collection<V>>() : new HashMap<K, Collection<V>>(); } - public void putAll(K key, Collection<V> values) { + public void putAll(K key, @NotNull Collection<V> values) { for (V value : values) { put(key, value); } } - public void putAll(K key, V... values) { + public void putAll(K key, @NotNull V... values) { for (V value : values) { put(key, value); } } public void put(K key, V value) { - if (!myBaseMap.containsKey(key)) { - myBaseMap.put(key, myOrdered ? new LinkedHashSet<V>() : new HashSet<V>()); + Collection<V> collection = myBaseMap.get(key); + if (collection == null) { + collection = myOrdered ? new LinkedHashSet<V>() : new HashSet<V>(); + myBaseMap.put(key, collection); } - myBaseMap.get(key).add(value); + collection.add(value); } - @Nullable public Collection<V> get(K key){ return myBaseMap.get(key); } + @NotNull public Set<K> keySet() { return myBaseMap.keySet(); } + @NotNull public Collection<V> values() { Set<V> result = myOrdered ? new LinkedHashSet<V>() : new HashSet<V>(); for (final Collection<V> values : myBaseMap.values()) { @@ -88,6 +92,7 @@ public class MultiValuesMap<K, V>{ return myBaseMap.remove(key); } + @NotNull public Set<Map.Entry<K, Collection<V>>> entrySet() { return myBaseMap.entrySet(); } @@ -100,6 +105,7 @@ public class MultiValuesMap<K, V>{ return myBaseMap.containsKey(key); } + @NotNull public Collection<V> collectValues() { Collection<V> result = new HashSet<V>(); for (Collection<V> v : myBaseMap.values()) { diff --git a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java index 93fb443f181d..5a1c6af28b9b 100644 --- a/platform/util/src/com/intellij/openapi/util/text/StringUtil.java +++ b/platform/util/src/com/intellij/openapi/util/text/StringUtil.java @@ -968,8 +968,14 @@ public class StringUtil extends StringUtilRt { } @Contract("null -> true") - public static boolean isEmptyOrSpaces(@Nullable final String s) { - if (s == null || s.isEmpty()) { + // we need to keep this method to preserve backward compatibility + public static boolean isEmptyOrSpaces(@Nullable String s) { + return isEmptyOrSpaces(((CharSequence)s)); + } + + @Contract("null -> true") + public static boolean isEmptyOrSpaces(@Nullable CharSequence s) { + if (isEmpty(s)) { return true; } for (int i = 0; i < s.length(); i++) { @@ -1914,12 +1920,17 @@ public class StringUtil extends StringUtilRt { } public static int countChars(@NotNull CharSequence text, char c) { - int count = 0; + return countChars(text, c, 0, false); + } - for (int i = 0; i < text.length(); ++i) { - final char ch = text.charAt(i); - if (ch == c) { - ++count; + public static int countChars(@NotNull CharSequence text, char c, int offset, boolean continuous) { + int count = 0; + for (int i = offset; i < text.length(); ++i) { + if (text.charAt(i) == c) { + count++; + } + else if (continuous) { + break; } } return count; @@ -2624,7 +2635,7 @@ public class StringUtil extends StringUtilRt { * i.e. when java.util.regex.Pattern match goes out of control. */ public abstract static class BombedCharSequence implements CharSequence { - private CharSequence delegate; + private final CharSequence delegate; private int i = 0; public BombedCharSequence(@NotNull CharSequence sequence) { diff --git a/platform/util/src/com/intellij/util/ArrayUtil.java b/platform/util/src/com/intellij/util/ArrayUtil.java index 1f75e0c78065..1e47adf8fcf1 100644 --- a/platform/util/src/com/intellij/util/ArrayUtil.java +++ b/platform/util/src/com/intellij/util/ArrayUtil.java @@ -441,6 +441,10 @@ public class ArrayUtil extends ArrayUtilRt { return indexOf(src, obj); } + public static <T> int find(@NotNull final T[] src, final T obj) { + return ArrayUtilRt.find(src, obj); + } + public static boolean startsWith(@NotNull byte[] array, @NotNull byte[] prefix) { if (array == prefix) { return true; diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java index 897c3c392770..df768fdfa56d 100644 --- a/platform/util/src/com/intellij/util/ReflectionUtil.java +++ b/platform/util/src/com/intellij/util/ReflectionUtil.java @@ -367,7 +367,7 @@ public class ReflectionUtil { } } - public static boolean isAssignable(@NotNull Class<?> ancestor, Class<?> descendant) { + public static boolean isAssignable(@NotNull Class<?> ancestor, @NotNull Class<?> descendant) { return ancestor == descendant || ancestor.isAssignableFrom(descendant); } } diff --git a/platform/util/src/com/intellij/util/diff/FilesTooBigForDiffException.java b/platform/util/src/com/intellij/util/diff/FilesTooBigForDiffException.java index 55c06ac43572..a6f2a2bb3fc3 100644 --- a/platform/util/src/com/intellij/util/diff/FilesTooBigForDiffException.java +++ b/platform/util/src/com/intellij/util/diff/FilesTooBigForDiffException.java @@ -6,7 +6,8 @@ package com.intellij.util.diff; * Time: 10:30 PM */ public class FilesTooBigForDiffException extends Exception { - public static int MAX_BUFFER_LEN = 10000000; + public static int MAX_BUFFER_LEN = 10000000; // Limit for memory consumption in IntLCS algorithm. ~ 2000 changed lines, 50Mb memory + public static int MAX_BAD_LINES = 3; // Do not try to compare two lines by-word after this much fails. private final int myNumLines; diff --git a/platform/util/src/com/intellij/util/diff/PatienceIntLCS.java b/platform/util/src/com/intellij/util/diff/PatienceIntLCS.java index 8f04dfa10257..5acb8272c8fb 100644 --- a/platform/util/src/com/intellij/util/diff/PatienceIntLCS.java +++ b/platform/util/src/com/intellij/util/diff/PatienceIntLCS.java @@ -55,7 +55,7 @@ public class PatienceIntLCS { return; } - int startOffset = matchForward(0, 0); + int startOffset = matchForward(myStart1, myStart2); int start1 = myStart1 + startOffset; int start2 = myStart2 + startOffset; diff --git a/platform/util/src/com/intellij/util/diff/Reindexer.java b/platform/util/src/com/intellij/util/diff/Reindexer.java index e30849e5853b..1d8f68b4886b 100644 --- a/platform/util/src/com/intellij/util/diff/Reindexer.java +++ b/platform/util/src/com/intellij/util/diff/Reindexer.java @@ -16,6 +16,7 @@ package com.intellij.util.diff; import gnu.trove.TIntArrayList; +import org.jetbrains.annotations.TestOnly; import java.util.Arrays; import java.util.BitSet; @@ -33,6 +34,7 @@ class Reindexer { return new int[][]{discarded1, discard(discarded1, ints2, 1)}; } + @TestOnly void idInit(int length1, int length2) { myOriginalLengths[0] = length1; myOriginalLengths[1] = length2; @@ -41,12 +43,14 @@ class Reindexer { for (int j = 0; j < 2; j++) { int originalLength = myOriginalLengths[j]; myOldIndecies[j] = new int[originalLength]; - for (int i = 0; i < originalLength; i++) + for (int i = 0; i < originalLength; i++) { myOldIndecies[j][i] = i; + } } } - public int restoreIndex(int index, int array) { + @TestOnly + int restoreIndex(int index, int array) { return myOldIndecies[array][index]; } @@ -75,50 +79,58 @@ class Reindexer { } public void reindex(BitSet[] discardedChanges, LCSBuilder builder) { - BitSet changes1 = new BitSet(myOriginalLengths[0]); - BitSet changes2 = new BitSet(myOriginalLengths[1]); + BitSet changes1; + BitSet changes2; - int x = 0; - int y = 0; - while (x < myDiscardedLengths[0] || y < myDiscardedLengths[1]) { - if ((x < myDiscardedLengths[0] && y < myDiscardedLengths[1]) && !discardedChanges[0].get(x) && !discardedChanges[1].get(y)) { - x = increment(myOldIndecies[0], x, changes1, myOriginalLengths[0]); - y = increment(myOldIndecies[1], y, changes2, myOriginalLengths[1]); - continue; + if (myDiscardedLengths[0] == myOriginalLengths[0] && myDiscardedLengths[1] == myOriginalLengths[1]) { + changes1 = discardedChanges[0]; + changes2 = discardedChanges[1]; + } + else { + changes1 = new BitSet(myOriginalLengths[0]); + changes2 = new BitSet(myOriginalLengths[1]); + int x = 0; + int y = 0; + while (x < myDiscardedLengths[0] || y < myDiscardedLengths[1]) { + if ((x < myDiscardedLengths[0] && y < myDiscardedLengths[1]) && !discardedChanges[0].get(x) && !discardedChanges[1].get(y)) { + x = increment(myOldIndecies[0], x, changes1, myOriginalLengths[0]); + y = increment(myOldIndecies[1], y, changes2, myOriginalLengths[1]); + continue; + } + if (discardedChanges[0].get(x)) { + changes1.set(getOriginal(myOldIndecies[0], x)); + x = increment(myOldIndecies[0], x, changes1, myOriginalLengths[0]); + continue; + } + if (discardedChanges[1].get(y)) { + changes2.set(getOriginal(myOldIndecies[1], y)); + y = increment(myOldIndecies[1], y, changes2, myOriginalLengths[1]); + continue; + } } - if (discardedChanges[0].get(x)) { - changes1.set(getOriginal(myOldIndecies[0], x)); - x = increment(myOldIndecies[0], x, changes1, myOriginalLengths[0]); - continue; + if (myDiscardedLengths[0] == 0) { + changes1.set(0, myOriginalLengths[0]); } - if (discardedChanges[1].get(y)) { - changes2.set(getOriginal(myOldIndecies[1], y)); - y = increment(myOldIndecies[1], y, changes2, myOriginalLengths[1]); - continue; + else { + changes1.set(0, myOldIndecies[0][0]); + } + if (myDiscardedLengths[1] == 0) { + changes2.set(0, myOriginalLengths[1]); + } + else { + changes2.set(0, myOldIndecies[1][0]); } - } - if (myDiscardedLengths[0] == 0) { - changes1.set(0, myOriginalLengths[0]); - } - else { - changes1.set(0, myOldIndecies[0][0]); - } - if (myDiscardedLengths[1] == 0) { - changes2.set(0, myOriginalLengths[1]); - } - else { - changes2.set(0, myOldIndecies[1][0]); } - x = 0; - y = 0; + int x = 0; + int y = 0; while (x < myOriginalLengths[0] && y < myOriginalLengths[1]) { int startX = x; while (x < myOriginalLengths[0] && y < myOriginalLengths[1] && !changes1.get(x) && !changes2.get(y)) { x++; y++; } - if (x> startX) builder.addEqual(x - startX); + if (x > startX) builder.addEqual(x - startX); int dx = 0; int dy = 0; while (x < myOriginalLengths[0] && changes1.get(x)) { diff --git a/platform/util/src/com/intellij/util/text/SemVer.java b/platform/util/src/com/intellij/util/text/SemVer.java index c0ca07f1c15e..5c5cdbfe849c 100644 --- a/platform/util/src/com/intellij/util/text/SemVer.java +++ b/platform/util/src/com/intellij/util/text/SemVer.java @@ -29,13 +29,20 @@ public class SemVer { private final int myMajor; private final int myMinor; private final int myPatch; + private final String myRawVersion; - public SemVer(int major, int minor, int patch) { + public SemVer(@NotNull String rawVersion, int major, int minor, int patch) { + myRawVersion = rawVersion; myMajor = major; myMinor = minor; myPatch = patch; } + @NotNull + public String getRawVersion() { + return myRawVersion; + } + public int getMajor() { return myMajor; } @@ -85,7 +92,7 @@ public class SemVer { } Integer patch = toInteger(patchStr); if (major != null && minor != null && patch != null) { - return new SemVer(major, minor, patch); + return new SemVer(text, major, minor, patch); } return null; } diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index e9eebf39a215..5cb7ad4bf206 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -224,6 +224,8 @@ public class UIUtil { } public static boolean isRetina() { + if (GraphicsEnvironment.isHeadless()) return false; + //Temporary workaround for HiDPI on Windows/Linux if ("true".equalsIgnoreCase(System.getProperty("is.hidpi"))) { return true; @@ -2742,4 +2744,38 @@ public class UIUtil { catch (IllegalAccessException e) { LOG.debug(e); } } } + + //May have no usages but it's useful in runtime (Debugger "watches", some logging etc.) + public static String getDebugText(Component c) { + StringBuilder builder = new StringBuilder(); + getAllTextsRecursivelyImpl(c, builder); + return builder.toString(); + } + + private static void getAllTextsRecursivelyImpl(Component component, StringBuilder builder) { + String candidate = ""; + int limit = builder.length() > 60 ? 20 : 40; + if (component instanceof JLabel) candidate = ((JLabel)component).getText(); + if (component instanceof JTextComponent) candidate = ((JTextComponent)component).getText(); + if (component instanceof AbstractButton) candidate = ((AbstractButton)component).getText(); + if (StringUtil.isNotEmpty(candidate)) { + builder.append(candidate.length() > limit ? (candidate.substring(0, limit - 3) + "...") : candidate).append('|'); + } + if (component instanceof Container) { + Component[] components = ((Container)component).getComponents(); + for (Component child : components) { + getAllTextsRecursivelyImpl(child, builder); + } + } + } + + public static boolean isAncestor(@NotNull Component ancestor, @Nullable Component descendant) { + while (descendant != null) { + if (descendant == ancestor) { + return true; + } + descendant = descendant.getParent(); + } + return false; + } } diff --git a/platform/util/testSrc/com/intellij/util/diff/PatienceIntLCSTest.java b/platform/util/testSrc/com/intellij/util/diff/PatienceIntLCSTest.java index eb9c1dc2905e..e82a990e45d3 100644 --- a/platform/util/testSrc/com/intellij/util/diff/PatienceIntLCSTest.java +++ b/platform/util/testSrc/com/intellij/util/diff/PatienceIntLCSTest.java @@ -70,6 +70,13 @@ public class PatienceIntLCSTest extends TestCase { new int[]{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}); } + public void testBug1() throws FilesTooBigForDiffException { + BitSet[] change = buildChange(new int[]{2, 3, 4, 6, 7, 8, 9, 11, 12, 4, 6, 11, 15}, + new int[]{2, 3, 6, 7, 8, 9, 6, 11, 12, 4, 11, 15, 6}); + checkChange(change, new int[]{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, + new int[]{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0}); + } + public void testInnerChunks1() throws FilesTooBigForDiffException { BitSet[] change = buildChange(new int[]{0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0}, new int[]{1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1}); checkChange(change, new int[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}, new int[]{1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1}); diff --git a/platform/util/testSrc/com/intellij/util/text/SemVerTest.java b/platform/util/testSrc/com/intellij/util/text/SemVerTest.java index 19839b424af5..5edd5d925e86 100644 --- a/platform/util/testSrc/com/intellij/util/text/SemVerTest.java +++ b/platform/util/testSrc/com/intellij/util/text/SemVerTest.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. @@ -15,7 +15,7 @@ */ package com.intellij.util.text; -import junit.framework.Assert; +import org.junit.Assert; import org.junit.Test; /** @@ -24,15 +24,17 @@ import org.junit.Test; public class SemVerTest { @Test public void testParsing() throws Exception { - SemVer semVer = SemVer.parseFromText("0.9.2"); + String version = "0.9.2"; + SemVer semVer = SemVer.parseFromText(version); Assert.assertNotNull(semVer); - Assert.assertEquals(new SemVer(0, 9, 2), semVer); + Assert.assertEquals(new SemVer(version, 0, 9, 2), semVer); } @Test public void testExtendedVersion() throws Exception { - SemVer semVer = SemVer.parseFromText("0.9.2-dart"); + String version = "0.9.2-dart"; + SemVer semVer = SemVer.parseFromText(version); Assert.assertNotNull(semVer); - Assert.assertEquals(new SemVer(0, 9, 2), semVer); + Assert.assertEquals(new SemVer(version, 0, 9, 2), semVer); } } diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java index 84fa170df21d..e2f948442184 100644 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.java +++ b/platform/vcs-api/src/com/intellij/openapi/vcs/VcsVFSListener.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.vfs.*; import com.intellij.openapi.vfs.newvfs.NewVirtualFile; import com.intellij.util.SmartList; import com.intellij.vcsUtil.VcsUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; @@ -313,14 +314,14 @@ public abstract class VcsVFSListener implements Disposable { protected abstract boolean isDirectoryVersioningSupported(); private class MyVirtualFileAdapter extends VirtualFileAdapter { - public void fileCreated(final VirtualFileEvent event) { + public void fileCreated(@NotNull final VirtualFileEvent event) { VirtualFile file = event.getFile(); if (isUnderMyVcs(file)) { VcsVFSListener.this.fileAdded(event, file); } } - public void fileCopied(final VirtualFileCopyEvent event) { + public void fileCopied(@NotNull final VirtualFileCopyEvent event) { if (isEventIgnored(event, true) || myChangeListManager.isIgnoredFile(event.getFile())) return; final AbstractVcs oldVcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getOriginalFile()); if (oldVcs == myVcs) { @@ -335,7 +336,7 @@ public abstract class VcsVFSListener implements Disposable { } } - public void beforeFileDeletion(final VirtualFileEvent event) { + public void beforeFileDeletion(@NotNull final VirtualFileEvent event) { final VirtualFile file = event.getFile(); if (isEventIgnored(event, true)) { return; @@ -356,7 +357,7 @@ public abstract class VcsVFSListener implements Disposable { } } - public void beforeFileMovement(final VirtualFileMoveEvent event) { + public void beforeFileMovement(@NotNull final VirtualFileMoveEvent event) { if (isEventIgnored(event, true)) return; final VirtualFile file = event.getFile(); final AbstractVcs newVcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getNewParent()); @@ -368,7 +369,7 @@ public abstract class VcsVFSListener implements Disposable { } } - public void fileMoved(final VirtualFileMoveEvent event) { + public void fileMoved(@NotNull final VirtualFileMoveEvent event) { if (isEventIgnored(event, true)) return; final AbstractVcs oldVcs = ProjectLevelVcsManager.getInstance(myProject).getVcsFor(event.getOldParent()); if (oldVcs != myVcs) { @@ -376,7 +377,7 @@ public abstract class VcsVFSListener implements Disposable { } } - public void beforePropertyChange(final VirtualFilePropertyEvent event) { + public void beforePropertyChange(@NotNull final VirtualFilePropertyEvent event) { if (!isEventIgnored(event, false) && event.getPropertyName().equalsIgnoreCase(VirtualFile.PROP_NAME)) { String oldName = (String)event.getOldValue(); String newName = (String)event.getNewValue(); @@ -393,7 +394,7 @@ public abstract class VcsVFSListener implements Disposable { } @Override - public void beforeContentsChange(VirtualFileEvent event) { + public void beforeContentsChange(@NotNull VirtualFileEvent event) { VirtualFile file = event.getFile(); assert !file.isDirectory(); if (isUnderMyVcs(file)) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/annotate/VFSForAnnotationListener.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/annotate/VFSForAnnotationListener.java index 7cb1bb347414..97771282b6eb 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/annotate/VFSForAnnotationListener.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/annotate/VFSForAnnotationListener.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.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileAdapter; import com.intellij.openapi.vfs.VirtualFileEvent; import com.intellij.openapi.vfs.VirtualFilePropertyEvent; +import org.jetbrains.annotations.NotNull; public class VFSForAnnotationListener extends VirtualFileAdapter { private final VirtualFile myFile; @@ -31,7 +32,7 @@ public class VFSForAnnotationListener extends VirtualFileAdapter { } @Override - public void propertyChanged(VirtualFilePropertyEvent event) { + public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { if (! Comparing.equal(myFile, event.getFile())) return; if (! event.isFromRefresh()) return; @@ -43,7 +44,7 @@ public class VFSForAnnotationListener extends VirtualFileAdapter { } @Override - public void contentsChanged(VirtualFileEvent event) { + public void contentsChanged(@NotNull VirtualFileEvent event) { if (! Comparing.equal(myFile, event.getFile())) return; if (! event.isFromRefresh()) return; if (! myFile.isWritable()) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FileAndDocumentListenersForShortDiff.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FileAndDocumentListenersForShortDiff.java index 57241b2d1d21..d4a2c8c28751 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FileAndDocumentListenersForShortDiff.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FileAndDocumentListenersForShortDiff.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. @@ -24,6 +24,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileAdapter; import com.intellij.openapi.vfs.VirtualFileEvent; import com.intellij.openapi.vfs.VirtualFileManager; +import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -59,17 +60,17 @@ public abstract class FileAndDocumentListenersForShortDiff { private class MyFileListener extends VirtualFileAdapter { @Override - public void contentsChanged(VirtualFileEvent event) { + public void contentsChanged(@NotNull VirtualFileEvent event) { impl(event.getFile()); } @Override - public void fileCreated(VirtualFileEvent event) { + public void fileCreated(@NotNull VirtualFileEvent event) { impl(event.getFile()); } @Override - public void fileDeleted(VirtualFileEvent event) { + public void fileDeleted(@NotNull VirtualFileEvent event) { impl(event.getFile()); } } diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java index 7528495aa35c..5b95283e1b30 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/FragmentedDiffRequestFromChange.java @@ -15,7 +15,6 @@ */ package com.intellij.openapi.vcs.changes; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.diff.impl.ComparisonPolicy; import com.intellij.openapi.diff.impl.external.DiffManagerImpl; @@ -112,63 +111,70 @@ public class FragmentedDiffRequestFromChange { return myOldDocument; } - public void execute(final Change change, final FilePath filePath, final SLRUMap<Pair<Long, String>, List<BeforeAfter<TextRange>>> cache, + public void execute(final Change change, + final FilePath filePath, + final SLRUMap<Pair<Long, String>, List<BeforeAfter<TextRange>>> cache, final LineStatusTrackerManagerI lstManager) { - ApplicationManager.getApplication().runReadAction(new Runnable() { - @Override - public void run() { - try { - myDocument = null; - myOldDocument = documentFromRevision(change.getBeforeRevision()); - final String convertedPath = FilePathsHelper.convertPath(filePath); - if (filePath.getVirtualFile() != null) { - myDocument = FileStatus.DELETED.equals(change.getFileStatus()) ? new DocumentImpl("") : - FileDocumentManager.getInstance().getDocument(filePath.getVirtualFile()); - if (myDocument != null) { - final List<BeforeAfter<TextRange>> cached = cache.get(new Pair<Long, String>(myDocument.getModificationStamp(), convertedPath)); - if (cached != null) { - myRanges = cached; - return; - } - } + try { + myDocument = null; + myOldDocument = documentFromRevision(change.getBeforeRevision()); + final String convertedPath = FilePathsHelper.convertPath(filePath); + if (filePath.getVirtualFile() != null) { + myDocument = FileStatus.DELETED.equals(change.getFileStatus()) + ? new DocumentImpl("") + : FileDocumentManager.getInstance().getDocument(filePath.getVirtualFile()); + if (myDocument != null) { + final List<BeforeAfter<TextRange>> cached = cache.get(new Pair<Long, String>(myDocument.getModificationStamp(), convertedPath)); + if (cached != null) { + myRanges = cached; + return; } + } + } - if (myDocument == null) { - myDocument = documentFromRevision(change.getAfterRevision()); - final List<BeforeAfter<TextRange>> cached = cache.get(new Pair<Long, String>(-1L, convertedPath)); - if (cached != null) { - myRanges = cached; - return; - } - } + if (myDocument == null) { + myDocument = documentFromRevision(change.getAfterRevision()); + final List<BeforeAfter<TextRange>> cached = cache.get(new Pair<Long, String>(-1L, convertedPath)); + if (cached != null) { + myRanges = cached; + return; + } + } - ComparisonPolicy comparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy(); - if (comparisonPolicy == null) { - comparisonPolicy = ComparisonPolicy.DEFAULT; + ComparisonPolicy comparisonPolicy = DiffManagerImpl.getInstanceEx().getComparisonPolicy(); + if (comparisonPolicy == null) { + comparisonPolicy = ComparisonPolicy.DEFAULT; + } + final TextCompareProcessor processor = new TextCompareProcessor(comparisonPolicy); + final ArrayList<LineFragment> lineFragments = processor.process(myOldDocument.getText(), myDocument.getText()); + myRanges = new ArrayList<BeforeAfter<TextRange>>(lineFragments.size()); + for (LineFragment lineFragment : lineFragments) { + if (!lineFragment.isEqual()) { + final TextRange oldRange = lineFragment.getRange(FragmentSide.SIDE1); + final TextRange newRange = lineFragment.getRange(FragmentSide.SIDE2); + int beforeBegin = myOldDocument.getLineNumber(oldRange.getStartOffset()); + int beforeEnd = myOldDocument.getLineNumber(correctRangeEnd(oldRange.getEndOffset(), myOldDocument)); + int afterBegin = myDocument.getLineNumber(newRange.getStartOffset()); + int afterEnd = myDocument.getLineNumber(correctRangeEnd(newRange.getEndOffset(), myDocument)); + if (oldRange.isEmpty()) { + beforeEnd = beforeBegin - 1; } - final TextCompareProcessor processor = new TextCompareProcessor(comparisonPolicy); - final ArrayList<LineFragment> lineFragments = processor.process(myOldDocument.getText(), myDocument.getText()); - myRanges = new ArrayList<BeforeAfter<TextRange>>(lineFragments.size()); - for (LineFragment lineFragment : lineFragments) { - if (! lineFragment.isEqual()) { - final TextRange oldRange = lineFragment.getRange(FragmentSide.SIDE1); - final TextRange newRange = lineFragment.getRange(FragmentSide.SIDE2); - myRanges.add(new BeforeAfter<TextRange>(new UnfairTextRange(myOldDocument.getLineNumber(oldRange.getStartOffset()), - myOldDocument.getLineNumber(correctRangeEnd(oldRange.getEndOffset(), myOldDocument))), - new UnfairTextRange(myDocument.getLineNumber(newRange.getStartOffset()), - myDocument.getLineNumber(correctRangeEnd(newRange.getEndOffset(), myDocument))))); - } + if (newRange.isEmpty()) { + afterEnd = afterBegin - 1; } - cache.put(new Pair<Long, String>(myDocument.getModificationStamp(), convertedPath), new ArrayList<BeforeAfter<TextRange>>(myRanges)); - } - catch (VcsException e) { - myException = e; - } - catch (FilesTooBigForDiffException e) { - myException = new VcsException(e); + myRanges + .add(new BeforeAfter<TextRange>(new UnfairTextRange(beforeBegin, beforeEnd), new UnfairTextRange(afterBegin, afterEnd))); } } - }); + cache + .put(new Pair<Long, String>(myDocument.getModificationStamp(), convertedPath), new ArrayList<BeforeAfter<TextRange>>(myRanges)); + } + catch (VcsException e) { + myException = e; + } + catch (FilesTooBigForDiffException e) { + myException = new VcsException(e); + } } private int correctRangeEnd(final int end, final Document document) { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java index 30d8f5ef88c0..03788f196192 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/RemoteRevisionsNumbersCache.java @@ -57,9 +57,8 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { return "NOT_LOADED"; } - public int compareTo(VcsRevisionNumber o) { - if (o == this) return 0; - return -1; + public int compareTo(@NotNull VcsRevisionNumber o) { + return o == this ? 0 : -1; } }; public static final VcsRevisionNumber UNKNOWN = new VcsRevisionNumber() { @@ -67,9 +66,8 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { return "UNKNOWN"; } - public int compareTo(VcsRevisionNumber o) { - if (o == this) return 0; - return -1; + public int compareTo(@NotNull VcsRevisionNumber o) { + return o == this ? 0 : -1; } }; private final VcsConfiguration myVcsConfiguration; @@ -156,7 +154,7 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { synchronized (myLock) { final LazyRefreshingSelfQueue<String> oldQueue = getQueue(oldVcsRoot); final LazyRefreshingSelfQueue<String> newQueue = getQueue(newVcsRoot); - myData.put(key, new Pair<VcsRoot, VcsRevisionNumber>(newVcsRoot, NOT_LOADED)); + myData.put(key, Pair.create(newVcsRoot, NOT_LOADED)); oldQueue.forceRemove(key); newQueue.addRequest(key); } @@ -178,7 +176,7 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { final Pair<VcsRoot, VcsRevisionNumber> value = myData.get(key); if (value == null) { final LazyRefreshingSelfQueue<String> queue = getQueue(vcsRoot); - myData.put(key, new Pair<VcsRoot, VcsRevisionNumber>(vcsRoot, NOT_LOADED)); + myData.put(key, Pair.create(vcsRoot, NOT_LOADED)); queue.addRequest(key); } else if (! value.getFirst().equals(vcsRoot)) { switchVcs(value.getFirst(), vcsRoot, key); @@ -196,7 +194,7 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { final LazyRefreshingSelfQueue<String> queue = getQueue(vcsRoot); queue.forceRemove(path); queue.addRequest(path); - myData.put(path, new Pair<VcsRoot, VcsRevisionNumber>(vcsRoot, NOT_LOADED)); + myData.put(path, Pair.create(vcsRoot, NOT_LOADED)); } } } @@ -268,7 +266,7 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { myData.put(s, new Pair<VcsRoot, VcsRevisionNumber>(myVcsRoot, newNumber)); } - if ((oldPair == null) || (oldPair != null) && (oldPair.getSecond().compareTo(newNumber) != 0)) { + if (oldPair == null || oldPair.getSecond().compareTo(newNumber) != 0) { LOG.debug("refresh triggered by " + s); mySomethingChanged = true; } @@ -320,9 +318,6 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { /** * Returns {@code true} if passed revision is up to date, comparing to latest repository revision. - * - * @param revision - * @return */ private boolean getRevisionState(final ContentRevision revision) { if (revision != null) { @@ -330,10 +325,8 @@ public class RemoteRevisionsNumbersCache implements ChangesOnServerTracker { final VcsRevisionNumber local = revision.getRevisionNumber(); final String path = revision.getFile().getIOFile().getAbsolutePath(); final VcsRevisionNumber remote = getNumber(path); - if ((NOT_LOADED == remote) || (UNKNOWN == remote)) { - return true; - } - return local.compareTo(remote) >= 0; + + return NOT_LOADED == remote || UNKNOWN == remote || local.compareTo(remote) >= 0; } return true; } 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 a09ebb908593..e652c425ec64 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 @@ -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. @@ -197,7 +197,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper { if (myCanChangePatchFile) { myListener = new VirtualFileAdapter() { @Override - public void contentsChanged(VirtualFileEvent event) { + public void contentsChanged(@NotNull VirtualFileEvent event) { if (myRecentPathFileChange.get() != null && myRecentPathFileChange.get().getVf() != null && myRecentPathFileChange.get().getVf().equals(event.getFile())) { queueRequest(); diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java index b297f051292e..4282e4465a81 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/LineStatusTrackerManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -425,7 +425,7 @@ public class LineStatusTrackerManager implements ProjectComponent, LineStatusTra } private class MyVirtualFileListener extends VirtualFileAdapter { - public void beforeContentsChange(VirtualFileEvent event) { + public void beforeContentsChange(@NotNull VirtualFileEvent event) { if (event.isFromRefresh()) { resetTracker(event.getFile()); } diff --git a/platform/vcs-log/impl/resources/icons/CollapseBranches.png b/platform/vcs-log/impl/resources/icons/CollapseBranches.png Binary files differindex c80e8d1c43b6..a57879659f21 100755 --- a/platform/vcs-log/impl/resources/icons/CollapseBranches.png +++ b/platform/vcs-log/impl/resources/icons/CollapseBranches.png diff --git a/platform/vcs-log/impl/resources/icons/ExpandBranches.png b/platform/vcs-log/impl/resources/icons/ExpandBranches.png Binary files differindex da22cae8252b..1edef2a07cbd 100755 --- a/platform/vcs-log/impl/resources/icons/ExpandBranches.png +++ b/platform/vcs-log/impl/resources/icons/ExpandBranches.png diff --git a/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png Binary files differindex 9dca4ea7001c..5a637179d268 100755 --- a/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png +++ b/platform/vcs-log/impl/resources/icons/ShowHideLongEdges.png diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XNamedValue.java b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XNamedValue.java index 48e93e484285..fc5be99947c6 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XNamedValue.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/XNamedValue.java @@ -27,6 +27,7 @@ public abstract class XNamedValue extends XValue { myName = name; } + @NotNull public final String getName() { return myName; } diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XKeywordValuePresentation.java b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XKeywordValuePresentation.java index c6d79ff881d2..c84cadd5b254 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XKeywordValuePresentation.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XKeywordValuePresentation.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; public class XKeywordValuePresentation extends XValuePresentation { private final String myValue; - public XKeywordValuePresentation(String value) { + public XKeywordValuePresentation(@NotNull String value) { myValue = value; } diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XValuePresentation.java b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XValuePresentation.java index 0fbc9c713f15..5467033f4e32 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XValuePresentation.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/frame/presentation/XValuePresentation.java @@ -15,6 +15,7 @@ */ package com.intellij.xdebugger.frame.presentation; +import com.intellij.openapi.editor.colors.TextAttributesKey; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -71,6 +72,8 @@ public abstract class XValuePresentation { */ void renderKeywordValue(@NotNull String value); + void renderValue(@NotNull String value, @NotNull TextAttributesKey key); + /** * Appends {@code value} surrounded by quotes to the node text colored as a string * @param value value to be shown 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 bb07eea52682..ea407a2cfcd4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -45,6 +45,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.MessageType; +import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.ToolWindowId; import com.intellij.ui.AppUIUtil; @@ -601,14 +602,15 @@ public class XDebugSessionImpl implements XDebugSession { CustomizedBreakpointPresentation presentation; synchronized (myRegisteredBreakpoints) { presentation = myRegisteredBreakpoints.get(breakpoint); - if (presentation != null) { - presentation.setErrorMessage(errorMessage); - presentation.setIcon(icon); + if (presentation == null || + (Comparing.equal(presentation.getIcon(), icon) && Comparing.strEqual(presentation.getErrorMessage(), errorMessage))) { + return; } + + presentation.setErrorMessage(errorMessage); + presentation.setIcon(icon); } - if (presentation != null) { - myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueBreakpointUpdate((XLineBreakpointImpl<?>)breakpoint); - } + myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueBreakpointUpdate((XLineBreakpointImpl<?>)breakpoint); } @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java index 579798caec5d..e5e511bc1f13 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java @@ -85,7 +85,7 @@ public class XSourcePositionImpl implements XSourcePosition { offset = -1; } else { - Document document = FileDocumentManager.getInstance().getDocument(file); + Document document = file.isValid() ? FileDocumentManager.getInstance().getDocument(file) : null; if (document == null) { return null; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java index a93429809896..6f334a7fab8b 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/CustomizedBreakpointPresentation.java @@ -26,11 +26,11 @@ public class CustomizedBreakpointPresentation { private Icon myIcon; private String myErrorMessage; - public void setIcon(final Icon icon) { + public void setIcon(@Nullable Icon icon) { myIcon = icon; } - public void setErrorMessage(final String errorMessage) { + public void setErrorMessage(@Nullable String errorMessage) { myErrorMessage = errorMessage; } @@ -39,6 +39,7 @@ public class CustomizedBreakpointPresentation { return myIcon; } + @Nullable public String getErrorMessage() { return myErrorMessage; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java index 6722c38841be..3cf9308bd9aa 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XBreakpointBase.java @@ -31,7 +31,10 @@ import com.intellij.util.xmlb.XmlSerializer; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerBundle; import com.intellij.xdebugger.XSourcePosition; -import com.intellij.xdebugger.breakpoints.*; +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.DebuggerSupport; import com.intellij.xdebugger.impl.XDebugSessionImpl; import com.intellij.xdebugger.impl.XDebuggerSupport; @@ -88,10 +91,12 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP myBreakpointManager.fireBreakpointChanged(this); } + @Override public XSourcePosition getSourcePosition() { return getType().getSourcePosition(this); } + @Override public Navigatable getNavigatable() { XSourcePosition position = getSourcePosition(); if (position == null) { @@ -100,10 +105,12 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP return position.createNavigatable(getProject()); } + @Override public boolean isEnabled() { return myState.isEnabled(); } + @Override public void setEnabled(final boolean enabled) { if (enabled != isEnabled()) { myState.setEnabled(enabled); @@ -111,11 +118,13 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP } } + @Override @NotNull public SuspendPolicy getSuspendPolicy() { return myState.getSuspendPolicy(); } + @Override public void setSuspendPolicy(@NotNull SuspendPolicy policy) { if (myState.getSuspendPolicy() != policy) { myState.setSuspendPolicy(policy); @@ -123,10 +132,12 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP } } + @Override public boolean isLogMessage() { return myState.isLogMessage(); } + @Override public void setLogMessage(final boolean logMessage) { if (logMessage != isLogMessage()) { myState.setLogMessage(logMessage); @@ -134,10 +145,12 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP } } + @Override public String getLogExpression() { return myState.getLogExpression(); } + @Override public void setLogExpression(@Nullable final String expression) { if (!Comparing.equal(getLogExpression(), expression)) { myState.setLogExpression(expression); @@ -145,10 +158,12 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP } } + @Override public String getCondition() { return myState.getCondition(); } + @Override public void setCondition(@Nullable final String condition) { if (!Comparing.equal(condition, getCondition())) { myState.setCondition(condition); @@ -165,11 +180,13 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP return true; } + @Override @Nullable public P getProperties() { return myProperties; } + @Override @NotNull public XBreakpointType<Self,P> getType() { return myType; @@ -331,6 +348,10 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP return myCustomizedPresentation != null ? myCustomizedPresentation.getErrorMessage() : null; } + CustomizedBreakpointPresentation getCustomizedPresentation() { + return myCustomizedPresentation; + } + public void setCustomizedPresentation(CustomizedBreakpointPresentation presentation) { myCustomizedPresentation = presentation; } @@ -350,16 +371,19 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP } protected class BreakpointGutterIconRenderer extends GutterIconRenderer { + @Override @NotNull public Icon getIcon() { return XBreakpointBase.this.getIcon(); } + @Override @Nullable public AnAction getClickAction() { return new RemoveBreakpointGutterIconAction(XBreakpointBase.this); } + @Override @Nullable public AnAction getMiddleButtonClickAction() { return new ToggleBreakpointGutterIconAction(XBreakpointBase.this); @@ -376,11 +400,13 @@ public class XBreakpointBase<Self extends XBreakpoint<P>, P extends XBreakpointP return Alignment.RIGHT; } + @Override @Nullable public ActionGroup getPopupMenuActions() { return null; } + @Override @Nullable public String getTooltipText() { return getDescription(); 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 d945c4209cdf..eb183f9145e9 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 @@ -321,10 +321,21 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta @Override public void updateBreakpointPresentation(@NotNull XLineBreakpoint<?> breakpoint, @Nullable Icon icon, @Nullable String errorMessage) { - final CustomizedBreakpointPresentation presentation = new CustomizedBreakpointPresentation(); + XLineBreakpointImpl lineBreakpoint = (XLineBreakpointImpl)breakpoint; + CustomizedBreakpointPresentation presentation = lineBreakpoint.getCustomizedPresentation(); + if (presentation == null) { + if (icon == null && errorMessage == null) { + return; + } + presentation = new CustomizedBreakpointPresentation(); + } + else if (Comparing.equal(presentation.getIcon(), icon) && Comparing.strEqual(presentation.getErrorMessage(), errorMessage)) { + return; + } + presentation.setErrorMessage(errorMessage); presentation.setIcon(icon); - ((XLineBreakpointImpl)breakpoint).setCustomizedPresentation(presentation); + lineBreakpoint.setCustomizedPresentation(presentation); myLineBreakpointManager.queueBreakpointUpdate(breakpoint); } @@ -459,6 +470,7 @@ public class XBreakpointManagerImpl implements XBreakpointManager, PersistentSta myBreakpoints = breakpoints; } + @SuppressWarnings("UnusedDeclaration") public void setDefaultBreakpoints(List<BreakpointState> defaultBreakpoints) { myDefaultBreakpoints = defaultBreakpoints; } 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 f478fe4cc453..6aae02242ec4 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 @@ -74,25 +74,38 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak } public void updateUI() { - if (myDisposed) return; - if (ApplicationManager.getApplication().isUnitTestMode()) return; + if (myDisposed || ApplicationManager.getApplication().isUnitTestMode()) { + return; + } Document document = getDocument(); - if (document == null) return; + if (document == null) { + return; + } EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); TextAttributes attributes = scheme.getAttributes(DebuggerColors.BREAKPOINT_ATTRIBUTES); - removeHighlighter(); - MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); - RangeHighlighter highlighter = markupModel.addPersistentLineHighlighter(getLine(), DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER, - attributes); + RangeHighlighter highlighter = myHighlighter; + if (highlighter != null && highlighter.isValid() && document.getLineNumber(highlighter.getStartOffset()) != getLine()) { + highlighter.dispose(); + myHighlighter = null; + highlighter = null; + } + + if (highlighter == null) { + MarkupModelEx markupModel = (MarkupModelEx)DocumentMarkupModel.forDocument(document, getProject(), true); + highlighter = markupModel.addPersistentLineHighlighter(getLine(), DebuggerColors.BREAKPOINT_HIGHLIGHTER_LAYER, attributes); + if (highlighter != null) { + highlighter.setGutterIconRenderer(createGutterIconRenderer()); + highlighter.putUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY, Boolean.TRUE); + myHighlighter = highlighter; + } + } + if (highlighter != null) { updateIcon(); - highlighter.setGutterIconRenderer(createGutterIconRenderer()); - highlighter.putUserData(DebuggerColors.BREAKPOINT_HIGHLIGHTER_KEY, Boolean.TRUE); } - myHighlighter = highlighter; } @Nullable @@ -149,7 +162,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak if (mySourcePosition == null) { new ReadAction() { @Override - protected void run(final Result result) { + protected void run(@NotNull Result result) { mySourcePosition = XDebuggerUtil.getInstance().createPosition(getFile(), getLine()); } }.execute(); @@ -201,8 +214,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak public void updatePosition() { if (myHighlighter != null && myHighlighter.isValid()) { - Document document = myHighlighter.getDocument(); - setLine(document.getLineNumber(myHighlighter.getStartOffset())); + setLine(myHighlighter.getDocument().getLineNumber(myHighlighter.getStartOffset())); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java index 138052e88714..3aab9e884b2d 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.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,10 @@ */ package com.intellij.xdebugger.impl.breakpoints; +import com.intellij.execution.impl.ConsoleViewUtil; import com.intellij.ide.startup.StartupManagerEx; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.Result; -import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.EditorFactory; @@ -27,6 +26,7 @@ import com.intellij.openapi.editor.colors.EditorColorsAdapter; import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.colors.EditorColorsScheme; import com.intellij.openapi.editor.event.*; +import com.intellij.openapi.editor.ex.util.EditorUtil; import com.intellij.openapi.editor.markup.MarkupEditorFilterFactory; import com.intellij.openapi.editor.markup.RangeHighlighter; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -38,8 +38,12 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.startup.StartupManager; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.*; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.openapi.vfs.VirtualFileEvent; +import com.intellij.openapi.vfs.VirtualFileManager; +import com.intellij.openapi.vfs.VirtualFileUrlChangeAdapter; import com.intellij.psi.PsiDocumentManager; +import com.intellij.util.SmartList; import com.intellij.util.containers.BidirectionalMap; import com.intellij.util.ui.update.MergingUpdateQueue; import com.intellij.util.ui.update.Update; @@ -50,7 +54,6 @@ import gnu.trove.TIntHashSet; import org.jetbrains.annotations.NotNull; import java.awt.event.MouseEvent; -import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -70,16 +73,14 @@ public class XLineBreakpointManager { myStartupManager = (StartupManagerEx)startupManager; if (!myProject.isDefault()) { - DocumentAdapter documentListener = new MyDocumentListener(); - EditorMouseAdapter editorMouseListener = new MyEditorMouseListener(); - EditorEventMulticaster editorEventMulticaster = EditorFactory.getInstance().getEventMulticaster(); - editorEventMulticaster.addDocumentListener(documentListener,project); - editorEventMulticaster.addEditorMouseListener(editorMouseListener, project); + editorEventMulticaster.addDocumentListener(new MyDocumentListener(), project); + editorEventMulticaster.addEditorMouseListener(new MyEditorMouseListener(), project); final MyDependentBreakpointListener myDependentBreakpointListener = new MyDependentBreakpointListener(); myDependentBreakpointManager.addListener(myDependentBreakpointListener); Disposer.register(project, new Disposable() { + @Override public void dispose() { myDependentBreakpointManager.removeListener(myDependentBreakpointListener); } @@ -96,8 +97,8 @@ public class XLineBreakpointManager { } @Override - public void fileDeleted(VirtualFileEvent event) { - List<XBreakpoint<?>> toRemove = new ArrayList<XBreakpoint<?>>(); + public void fileDeleted(@NotNull VirtualFileEvent event) { + List<XBreakpoint<?>> toRemove = new SmartList<XBreakpoint<?>>(); for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) { if (breakpoint.getFileUrl().equals(event.getFile().getUrl())) { toRemove.add(breakpoint); @@ -127,6 +128,7 @@ public class XLineBreakpointManager { if (myProject.isDefault()) return; Runnable runnable = new DumbAwareRunnable() { + @Override public void run() { for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) { breakpoint.updateUI(); @@ -159,12 +161,14 @@ public class XLineBreakpointManager { } } - private void updateBreakpoints(final Document document) { + private void updateBreakpoints(@NotNull Document document) { Collection<XLineBreakpointImpl> breakpoints = myBreakpoints.getKeysByValue(document); - if (breakpoints == null) return; + if (breakpoints == null) { + return; + } TIntHashSet lines = new TIntHashSet(); - final List<XBreakpoint<?>> toRemove = new ArrayList<XBreakpoint<?>>(); + List<XBreakpoint<?>> toRemove = new SmartList<XBreakpoint<?>>(); for (XLineBreakpointImpl breakpoint : breakpoints) { breakpoint.updatePosition(); if (!breakpoint.isValid() || !lines.add(breakpoint.getLine())) { @@ -176,19 +180,25 @@ public class XLineBreakpointManager { } private void removeBreakpoints(final List<? extends XBreakpoint<?>> toRemove) { - new WriteAction() { - protected void run(final Result result) { + if (toRemove.isEmpty()) { + return; + } + + ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override + public void run() { for (XBreakpoint<?> breakpoint : toRemove) { XDebuggerManager.getInstance(myProject).getBreakpointManager().removeBreakpoint(breakpoint); } } - }.execute(); + }); } public void breakpointChanged(final XLineBreakpointImpl breakpoint) { if (ApplicationManager.getApplication().isDispatchThread()) { breakpoint.updateUI(); - } else { + } + else { queueBreakpointUpdate(breakpoint); } } @@ -201,6 +211,7 @@ public class XLineBreakpointManager { public void queueBreakpointUpdate(@NotNull final XLineBreakpointImpl<?> breakpoint) { myBreakpointsUpdateQueue.queue(new Update(breakpoint) { + @Override public void run() { breakpoint.updateUI(); } @@ -209,6 +220,7 @@ public class XLineBreakpointManager { public void queueAllBreakpointsUpdate() { myBreakpointsUpdateQueue.queue(new Update("all breakpoints") { + @Override public void run() { for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) { breakpoint.updateUI(); @@ -218,11 +230,13 @@ public class XLineBreakpointManager { } private class MyDocumentListener extends DocumentAdapter { + @Override public void documentChanged(final DocumentEvent e) { final Document document = e.getDocument(); Collection<XLineBreakpointImpl> breakpoints = myBreakpoints.getKeysByValue(document); if (breakpoints != null && !breakpoints.isEmpty()) { myBreakpointsUpdateQueue.queue(new Update(document) { + @Override public void run() { updateBreakpoints(document); } @@ -232,7 +246,8 @@ public class XLineBreakpointManager { } private class MyEditorMouseListener extends EditorMouseAdapter { - public void mouseClicked(final EditorMouseEvent e) { + @Override + public void mouseClicked(EditorMouseEvent e) { final Editor editor = e.getEditor(); final MouseEvent mouseEvent = e.getMouseEvent(); if (mouseEvent.isPopupTrigger() @@ -240,20 +255,22 @@ public class XLineBreakpointManager { || mouseEvent.getButton() != MouseEvent.BUTTON1 || MarkupEditorFilterFactory.createIsDiffFilter().avaliableIn(editor) || e.getArea() != EditorMouseEventArea.LINE_MARKERS_AREA + || ConsoleViewUtil.isConsoleViewEditor(editor) ||!isFromMyProject(editor)) { return; } PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Runnable() { + @Override public void run() { - final int line = editor.xyToLogicalPosition(mouseEvent.getPoint()).line; + final int line = EditorUtil.yPositionToLogicalLine(editor, mouseEvent); final Document document = editor.getDocument(); final VirtualFile file = FileDocumentManager.getInstance().getFile(document); if (line >= 0 && line < document.getLineCount() && file != null) { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) { - XDebuggerUtil.getInstance().toggleLineBreakpoint(myProject, file, line, mouseEvent.isAltDown()); } } @@ -264,7 +281,11 @@ public class XLineBreakpointManager { } } - private boolean isFromMyProject(Editor editor) { + private boolean isFromMyProject(@NotNull Editor editor) { + if (myProject == editor.getProject()) { + return true; + } + for (FileEditor fileEditor : FileEditorManager.getInstance(myProject).getAllEditors()) { if (fileEditor instanceof TextEditor && ((TextEditor)fileEditor).getEditor().equals(editor)) { return true; @@ -274,10 +295,12 @@ public class XLineBreakpointManager { } private class MyDependentBreakpointListener implements XDependentBreakpointListener { + @Override public void dependencySet(final XBreakpoint<?> slave, final XBreakpoint<?> master) { queueBreakpointUpdate(slave); } + @Override public void dependencyCleared(final XBreakpoint<?> breakpoint) { queueBreakpointUpdate(breakpoint); } 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 784908be3613..9f04b9107619 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 @@ -49,10 +49,12 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor { new WatchEditorSessionListener(session).install(); } + @Override protected JComponent createInplaceEditorComponent() { return myExpressionEditor.getComponent(); } + @Override public void cancelEditing() { if (!isShown()) return; super.cancelEditing(); @@ -62,6 +64,7 @@ public class WatchInplaceEditor extends XDebuggerTreeInplaceEditor { } } + @Override public void doOKAction() { String expression = myExpressionEditor.getText(); myExpressionEditor.saveTextInHistory(); 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 d34ebcd9ad43..47485e568a14 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 @@ -102,7 +102,7 @@ public class ExecutionPointHighlighter { mySourcePosition = position; myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, mySourcePosition); - myEditor = FileEditorManager.getInstance(myProject).openTextEditor(myOpenFileDescriptor, false); + myEditor = myOpenFileDescriptor.getFile().isValid() ? FileEditorManager.getInstance(myProject).openTextEditor(myOpenFileDescriptor, false) : null; myUseSelection = useSelection; myGutterIconRenderer = renderer; if (myEditor != null) { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java index ee828b29b8b6..3db287f84210 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/TreeInplaceEditor.java @@ -116,6 +116,7 @@ public abstract class TreeInplaceEditor implements AWTEventListener { layeredPane.add(inplaceEditorComponent, new Integer(250)); myRemoveActions.add(new Runnable() { + @Override public void run() { layeredPane.remove(inplaceEditorComponent); } @@ -126,9 +127,11 @@ public abstract class TreeInplaceEditor implements AWTEventListener { getPreferredFocusedComponent().requestFocus(); final ComponentAdapter componentListener = new ComponentAdapter() { + @Override public void componentResized(ComponentEvent e) { final Project project = getProject(); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (!isShown() || project == null || project.isDisposed()) { return; @@ -146,14 +149,29 @@ public abstract class TreeInplaceEditor implements AWTEventListener { }); } + @Override public void componentHidden(ComponentEvent e) { cancelEditing(); } }; + + final HierarchyListener hierarchyListener = new HierarchyListener() { + @Override + public void hierarchyChanged(HierarchyEvent e) { + if (!tree.isShowing()) { + cancelEditing(); + } + } + }; + + tree.addHierarchyListener(hierarchyListener); tree.addComponentListener(componentListener); rootPane.addComponentListener(componentListener); + myRemoveActions.add(new Runnable() { + @Override public void run() { + tree.removeHierarchyListener(hierarchyListener); tree.addComponentListener(componentListener); rootPane.removeComponentListener(componentListener); } @@ -161,16 +179,19 @@ public abstract class TreeInplaceEditor implements AWTEventListener { final RunContentManager contentManager = ExecutionManager.getInstance(getProject()).getContentManager(); final RunContentListener runContentListener = new RunContentListener() { + @Override public void contentSelected(RunContentDescriptor descriptor) { cancelEditing(); } + @Override public void contentRemoved(RunContentDescriptor descriptor) { cancelEditing(); } }; contentManager.addRunContentListener(runContentListener); myRemoveActions.add(new Runnable() { + @Override public void run() { contentManager.removeRunContentListener(runContentListener); } @@ -179,18 +200,21 @@ public abstract class TreeInplaceEditor implements AWTEventListener { final JComponent editorComponent = getEditorComponent(); editorComponent.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enterStroke"); editorComponent.getActionMap().put("enterStroke", new AbstractAction() { + @Override public void actionPerformed(ActionEvent e) { doOKAction(); } }); editorComponent.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escapeStroke"); editorComponent.getActionMap().put("escapeStroke", new AbstractAction() { + @Override public void actionPerformed(ActionEvent e) { cancelEditing(); } }); final Toolkit defaultToolkit = Toolkit.getDefaultToolkit(); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { if (!isShown()) return; defaultToolkit.addAWTEventListener(TreeInplaceEditor.this, AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_WHEEL_EVENT_MASK); @@ -198,6 +222,7 @@ public abstract class TreeInplaceEditor implements AWTEventListener { }); myRemoveActions.add(new Runnable() { + @Override public void run() { defaultToolkit.removeAWTEventListener(TreeInplaceEditor.this); } @@ -208,6 +233,7 @@ public abstract class TreeInplaceEditor implements AWTEventListener { protected void onShown() { } + @Override public void eventDispatched(AWTEvent event) { if (!isShown()) { return; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchMessageNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchMessageNode.java index 488c1a2e69bb..cfa3e946ce87 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchMessageNode.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchMessageNode.java @@ -35,6 +35,7 @@ public class WatchMessageNode extends MessageTreeNode implements WatchNode { setIcon(icon); } + @Override @NotNull public String getExpression() { return myExpression; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java index 21ceb241babd..f959015b6f74 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/WatchesRootNode.java @@ -187,8 +187,7 @@ public class WatchesRootNode extends XDebuggerTreeNode { myChildren.set(index, messageNode); fireNodeStructureChanged(messageNode); } - WatchInplaceEditor editor = new WatchInplaceEditor(this, mySession, myWatchesView, messageNode, "watch", node); - editor.show(); + new WatchInplaceEditor(this, mySession, myWatchesView, messageNode, "watch", node).show(); } private class MyEvaluationCallback extends XEvaluationCallbackBase { diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueTextRendererBase.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueTextRendererBase.java index 9fb0aa2d394d..e2bc7379c757 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueTextRendererBase.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/XValueTextRendererBase.java @@ -39,5 +39,10 @@ public abstract class XValueTextRendererBase implements XValuePresentation.XValu renderRawValue(value, DefaultLanguageHighlighterColors.KEYWORD); } + @Override + public final void renderValue(@NotNull String value, @NotNull TextAttributesKey key) { + renderRawValue(value, key); + } + protected abstract void renderRawValue(@NotNull String value, @NotNull TextAttributesKey key); } |