Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
d2cc6528
Commit
d2cc6528
authored
6 years ago
by
Alexey Kudravtsev
Browse files
Options
Download
Email Patches
Plain Diff
cleanup
parent
fd16fb11
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
+2
-2
...ntellij/codeInsight/daemon/impl/LocalInspectionsPass.java
platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java
+22
-14
...ellij/openapi/roots/impl/ProjectRootManagerComponent.java
platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java
+4
-4
...api/src/com/intellij/openapi/fileChooser/FileChooser.java
platform/platform-api/src/com/intellij/openapi/fileChooser/PathChooserDialog.java
+1
-1
...c/com/intellij/openapi/fileChooser/PathChooserDialog.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/FileChooserAction.java
+2
-2
...tellij/openapi/fileChooser/actions/FileChooserAction.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
+15
-18
...ntellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileChooserFactoryImpl.java
+4
-2
...llij/openapi/fileChooser/impl/FileChooserFactoryImpl.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileTreeStructure.java
+3
-2
.../intellij/openapi/fileChooser/impl/FileTreeStructure.java
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java
+2
-1
...c/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java
platform/platform-impl/src/com/intellij/ui/mac/MacPathChooserDialog.java
+1
-1
...rm-impl/src/com/intellij/ui/mac/MacPathChooserDialog.java
platform/platform-impl/src/com/intellij/ui/win/WinPathChooserDialog.java
+1
-1
...rm-impl/src/com/intellij/ui/win/WinPathChooserDialog.java
platform/util/src/com/intellij/util/indexing/impl/ValueContainerImpl.java
+93
-89
...c/com/intellij/util/indexing/impl/ValueContainerImpl.java
spellchecker/src/com/intellij/spellchecker/settings/CustomDictionariesPanel.java
+1
-1
...tellij/spellchecker/settings/CustomDictionariesPanel.java
with
151 additions
and
138 deletions
+151
-138
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
+
2
-
2
View file @
d2cc6528
...
...
@@ -129,7 +129,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
@NotNull
final
List
<?
extends
LocalInspectionToolWrapper
>
toolWrappers
)
{
final
ProgressIndicator
progress
=
ProgressManager
.
getInstance
().
getProgressIndicator
();
inspect
(
new
ArrayList
<>(
toolWrappers
),
iManager
,
false
,
progress
);
addDescriptorsFromInjectedResults
(
iManager
,
context
);
addDescriptorsFromInjectedResults
(
context
);
List
<
InspectionResult
>
resultList
=
result
.
get
(
getFile
());
if
(
resultList
==
null
)
return
;
for
(
InspectionResult
inspectionResult
:
resultList
)
{
...
...
@@ -159,7 +159,7 @@ public class LocalInspectionsPass extends ProgressableTextEditorHighlightingPass
toolWrapper
.
getTool
());
}
private
void
addDescriptorsFromInjectedResults
(
@NotNull
InspectionManager
iManager
,
@NotNull
GlobalInspectionContextImpl
context
)
{
private
void
addDescriptorsFromInjectedResults
(
@NotNull
GlobalInspectionContextImpl
context
)
{
for
(
Map
.
Entry
<
PsiFile
,
List
<
InspectionResult
>>
entry
:
result
.
entrySet
())
{
PsiFile
file
=
entry
.
getKey
();
if
(
file
==
getFile
())
continue
;
// not injected
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/openapi/roots/impl/ProjectRootManagerComponent.java
+
22
-
14
View file @
d2cc6528
...
...
@@ -42,7 +42,6 @@ import com.intellij.util.indexing.UnindexedFilesUpdater;
import
com.intellij.util.messages.MessageBusConnection
;
import
gnu.trove.THashSet
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
java.io.File
;
import
java.util.Collection
;
...
...
@@ -60,8 +59,9 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
private
final
BatchUpdateListener
myHandler
;
private
final
MessageBusConnection
myConnection
;
@NotNull
private
Set
<
LocalFileSystem
.
WatchRequest
>
myRootsToWatch
=
new
THashSet
<>();
private
final
boolean
myDoLogCachesUpdate
;
private
final
boolean
LOG_CACHES_UPDATE
=
ApplicationManager
.
getApplication
().
isInternal
()
&&
!
ApplicationManager
.
getApplication
().
isUnitTestMode
()
;
private
Disposable
myRootPointersDisposable
=
Disposer
.
newDisposable
();
// accessed in EDT
public
ProjectRootManagerComponent
(
Project
project
,
StartupManager
startupManager
)
{
...
...
@@ -104,8 +104,6 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
myFileTypesChanged
.
levelDown
();
}
};
myDoLogCachesUpdate
=
ApplicationManager
.
getApplication
().
isInternal
()
&&
!
ApplicationManager
.
getApplication
().
isUnitTestMode
();
}
@Override
...
...
@@ -126,9 +124,10 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
@Override
protected
void
addRootsToWatch
()
{
final
Pair
<
Set
<
String
>,
Set
<
String
>>
roots
=
getAllRoots
();
if
(
roots
==
null
)
return
;
myRootsToWatch
=
LocalFileSystem
.
getInstance
().
replaceWatchedRoots
(
myRootsToWatch
,
roots
.
first
,
roots
.
second
);
if
(!
myProject
.
isDefault
())
{
Pair
<
Set
<
String
>,
Set
<
String
>>
roots
=
getAllRoots
();
myRootsToWatch
=
LocalFileSystem
.
getInstance
().
replaceWatchedRoots
(
myRootsToWatch
,
roots
.
first
,
roots
.
second
);
}
}
private
void
beforeRootsChange
(
boolean
fileTypes
)
{
...
...
@@ -148,7 +147,9 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
return
;
}
if
(
myDoLogCachesUpdate
)
LOG
.
debug
(
"refresh"
);
if
(
LOG_CACHES_UPDATE
)
{
LOG
.
debug
(
"refresh"
);
}
DumbServiceImpl
dumbService
=
DumbServiceImpl
.
getInstance
(
myProject
);
DumbModeTask
task
=
FileBasedIndexProjectHandler
.
createChangedFilesIndexingTask
(
myProject
);
if
(
task
!=
null
)
{
...
...
@@ -182,10 +183,9 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
}
}
@Null
able
@N
otN
ull
private
Pair
<
Set
<
String
>,
Set
<
String
>>
getAllRoots
()
{
ApplicationManager
.
getApplication
().
assertIsDispatchThread
();
if
(
myProject
.
isDefault
())
return
null
;
final
Set
<
String
>
recursiveDirs
=
new
THashSet
<>(
FileUtil
.
PATH_HASHING_STRATEGY
);
final
Set
<
String
>
files
=
new
THashSet
<>(
FileUtil
.
PATH_HASHING_STRATEGY
);
...
...
@@ -263,8 +263,12 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
protected
void
doSynchronizeRoots
()
{
if
(!
myStartupActivityPerformed
)
return
;
if
(
myDoLogCachesUpdate
||
LOG
.
isDebugEnabled
())
LOG
.
debug
(
new
Throwable
(
"sync roots"
));
else
if
(!
ApplicationManager
.
getApplication
().
isUnitTestMode
())
LOG
.
info
(
"project roots have changed"
);
if
(
LOG_CACHES_UPDATE
||
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
new
Throwable
(
"sync roots"
));
}
else
if
(!
ApplicationManager
.
getApplication
().
isUnitTestMode
())
{
LOG
.
info
(
"project roots have changed"
);
}
DumbServiceImpl
dumbService
=
DumbServiceImpl
.
getInstance
(
myProject
);
if
(
FileBasedIndex
.
getInstance
()
instanceof
FileBasedIndexImpl
)
{
...
...
@@ -337,13 +341,17 @@ public class ProjectRootManagerComponent extends ProjectRootManagerImpl implemen
if
(
myInsideRefresh
==
0
)
{
beforeRootsChange
(
false
);
if
(
myDoLogCachesUpdate
)
LOG
.
debug
(
new
Throwable
(
pointers
.
length
>
0
?
pointers
[
0
].
getPresentableUrl
():
""
));
if
(
LOG_CACHES_UPDATE
)
{
LOG
.
debug
(
new
Throwable
(
pointers
.
length
>
0
?
pointers
[
0
].
getPresentableUrl
():
""
));
}
}
else
if
(!
myPointerChangesDetected
)
{
//this is the first pointer changing validity
myPointerChangesDetected
=
true
;
myProject
.
getMessageBus
().
syncPublisher
(
ProjectTopics
.
PROJECT_ROOTS
).
beforeRootsChange
(
new
ModuleRootEventImpl
(
myProject
,
false
));
if
(
myDoLogCachesUpdate
)
LOG
.
debug
(
new
Throwable
(
pointers
.
length
>
0
?
pointers
[
0
].
getPresentableUrl
():
""
));
if
(
LOG_CACHES_UPDATE
)
{
LOG
.
debug
(
new
Throwable
(
pointers
.
length
>
0
?
pointers
[
0
].
getPresentableUrl
()
:
""
));
}
}
}
...
...
This diff is collapsed.
Click to expand it.
platform/platform-api/src/com/intellij/openapi/fileChooser/FileChooser.java
+
4
-
4
View file @
d2cc6528
...
...
@@ -68,7 +68,7 @@ public class FileChooser {
@Nullable
final
Component
parent
,
@Nullable
final
Project
project
,
@Nullable
final
VirtualFile
toSelect
)
{
Component
parentComponent
=
(
parent
==
null
)
?
KeyboardFocusManager
.
getCurrentKeyboardFocusManager
().
getActiveWindow
()
:
parent
;
Component
parentComponent
=
parent
==
null
?
KeyboardFocusManager
.
getCurrentKeyboardFocusManager
().
getActiveWindow
()
:
parent
;
LOG
.
assertTrue
(!
descriptor
.
isChooseMultiple
());
return
ArrayUtil
.
getFirstElement
(
chooseFiles
(
descriptor
,
parentComponent
,
project
,
toSelect
));
}
...
...
@@ -87,7 +87,7 @@ public class FileChooser {
public
static
void
chooseFiles
(
@NotNull
final
FileChooserDescriptor
descriptor
,
@Nullable
final
Project
project
,
@Nullable
final
VirtualFile
toSelect
,
@NotNull
final
Consumer
<
List
<
VirtualFile
>>
callback
)
{
@NotNull
final
Consumer
<
?
super
List
<
VirtualFile
>>
callback
)
{
chooseFiles
(
descriptor
,
project
,
null
,
toSelect
,
callback
);
}
...
...
@@ -107,8 +107,8 @@ public class FileChooser {
@Nullable
final
Project
project
,
@Nullable
final
Component
parent
,
@Nullable
final
VirtualFile
toSelect
,
@NotNull
final
Consumer
<
List
<
VirtualFile
>>
callback
)
{
Component
parentComponent
=
(
parent
==
null
)
?
WindowManager
.
getInstance
().
suggestParentWindow
(
project
)
:
parent
;
@NotNull
final
Consumer
<
?
super
List
<
VirtualFile
>>
callback
)
{
Component
parentComponent
=
parent
==
null
?
WindowManager
.
getInstance
().
suggestParentWindow
(
project
)
:
parent
;
final
FileChooserFactory
factory
=
FileChooserFactory
.
getInstance
();
final
PathChooserDialog
pathChooser
=
factory
.
createPathChooser
(
descriptor
,
project
,
parentComponent
);
pathChooser
.
choose
(
toSelect
,
callback
);
...
...
This diff is collapsed.
Click to expand it.
platform/platform-api/src/com/intellij/openapi/fileChooser/PathChooserDialog.java
+
1
-
1
View file @
d2cc6528
...
...
@@ -29,5 +29,5 @@ import java.util.List;
public
interface
PathChooserDialog
{
DataKey
<
Boolean
>
PREFER_LAST_OVER_EXPLICIT
=
DataKey
.
create
(
"prefer.last.over.explicit"
);
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
final
Consumer
<
List
<
VirtualFile
>>
callback
);
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
final
Consumer
<
?
super
List
<
VirtualFile
>>
callback
);
}
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/fileChooser/actions/FileChooserAction.java
+
2
-
2
View file @
d2cc6528
...
...
@@ -20,13 +20,13 @@ public abstract class FileChooserAction extends AnAction implements DumbAware {
}
@Override
final
public
void
actionPerformed
(
@NotNull
AnActionEvent
e
)
{
public
final
void
actionPerformed
(
@NotNull
AnActionEvent
e
)
{
FileSystemTree
tree
=
e
.
getData
(
FileSystemTree
.
DATA_KEY
);
actionPerformed
(
tree
,
e
);
}
@Override
final
public
void
update
(
@NotNull
AnActionEvent
e
)
{
public
final
void
update
(
@NotNull
AnActionEvent
e
)
{
FileSystemTree
tree
=
e
.
getData
(
FileSystemTree
.
DATA_KEY
);
if
(
tree
!=
null
)
{
e
.
getPresentation
().
setEnabled
(
true
);
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
+
15
-
18
View file @
d2cc6528
...
...
@@ -64,7 +64,7 @@ import java.util.*;
public
class
FileChooserDialogImpl
extends
DialogWrapper
implements
FileChooserDialog
,
PathChooserDialog
,
FileLookup
{
@NonNls
public
static
final
String
FILE_CHOOSER_SHOW_PATH_PROPERTY
=
"FileChooser.ShowPath"
;
p
ublic
static
final
String
RECENT_FILES_KEY
=
"file.chooser.recent.files"
;
p
rivate
static
final
String
RECENT_FILES_KEY
=
"file.chooser.recent.files"
;
public
static
final
String
DRAG_N_DROP_HINT
=
"Drag and drop a file into the space above to quickly locate it in the tree"
;
private
final
FileChooserDescriptor
myChooserDescriptor
;
protected
FileSystemTreeImpl
myFileSystemTree
;
...
...
@@ -79,7 +79,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
private
MergingUpdateQueue
myUiUpdater
;
private
boolean
myTreeIsUpdating
;
p
ublic
static
final
DataKey
<
PathField
>
PATH_FIELD
=
DataKey
.
create
(
"PathField"
);
p
rivate
static
final
DataKey
<
PathField
>
PATH_FIELD
=
DataKey
.
create
(
"PathField"
);
public
FileChooserDialogImpl
(
@NotNull
final
FileChooserDescriptor
descriptor
,
@Nullable
Project
project
)
{
super
(
project
,
true
);
...
...
@@ -108,7 +108,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
@NotNull
public
VirtualFile
[]
choose
(
@Nullable
final
Project
project
,
@NotNull
final
VirtualFile
...
toSelect
)
{
init
();
if
(
(
myProject
==
null
)
&&
(
project
!=
null
)
)
{
if
(
myProject
==
null
&&
project
!=
null
)
{
myProject
=
project
;
}
if
(
toSelect
.
length
==
1
)
{
...
...
@@ -137,7 +137,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
}
@Override
public
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
Consumer
<
List
<
VirtualFile
>>
callback
)
{
public
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
Consumer
<
?
super
List
<
VirtualFile
>>
callback
)
{
init
();
restoreSelection
(
toSelect
);
show
();
...
...
@@ -159,14 +159,14 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
}
}
protected
void
storeSelection
(
@Nullable
VirtualFile
file
)
{
void
storeSelection
(
@Nullable
VirtualFile
file
)
{
FileChooserUtil
.
setLastOpenedFile
(
myProject
,
file
);
if
(
file
!=
null
&&
file
.
getFileSystem
()
instanceof
LocalFileSystem
)
{
saveRecent
(
file
.
getPath
());
}
}
pr
otec
te
d
void
saveRecent
(
String
path
)
{
pr
iva
te
void
saveRecent
(
String
path
)
{
final
List
<
String
>
files
=
new
ArrayList
<>(
Arrays
.
asList
(
getRecentFiles
()));
files
.
remove
(
path
);
files
.
add
(
0
,
path
);
...
...
@@ -191,7 +191,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
}
pr
otec
te
d
JComponent
createHistoryButton
()
{
pr
iva
te
JComponent
createHistoryButton
()
{
JLabel
label
=
new
JLabel
(
AllIcons
.
Actions
.
Download
);
label
.
setToolTipText
(
"Recent files"
);
new
ClickListener
()
{
...
...
@@ -431,13 +431,10 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
tree
.
addTreeExpansionListener
(
new
FileTreeExpansionListener
());
setOKActionEnabled
(
false
);
myFileSystemTree
.
addListener
(
new
FileSystemTree
.
Listener
()
{
@Override
public
void
selectionChanged
(
@NotNull
final
List
<?
extends
VirtualFile
>
selection
)
{
// myTreeIsUpdating makes no sense for AsyncTreeModel
if
(
myTreeIsUpdating
&&
myFileSystemTree
.
getTreeBuilder
()
==
null
)
myTreeIsUpdating
=
false
;
updatePathFromTree
(
selection
,
false
);
}
myFileSystemTree
.
addListener
(
selection
->
{
// myTreeIsUpdating makes no sense for AsyncTreeModel
if
(
myTreeIsUpdating
&&
myFileSystemTree
.
getTreeBuilder
()
==
null
)
myTreeIsUpdating
=
false
;
updatePathFromTree
(
selection
,
false
);
},
myDisposable
);
new
FileDrop
(
tree
,
new
FileDrop
.
Target
()
{
...
...
@@ -453,7 +450,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
@Override
public
void
dropFiles
(
final
List
<
VirtualFile
>
files
)
{
if
(!
myChooserDescriptor
.
isChooseMultiple
()
&&
files
.
size
()
>
0
)
{
if
(!
myChooserDescriptor
.
isChooseMultiple
()
&&
!
files
.
isEmpty
()
)
{
selectInTree
(
new
VirtualFile
[]{
files
.
get
(
0
)},
true
,
true
);
}
else
{
...
...
@@ -470,7 +467,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
return
new
Tree
();
}
pr
otec
te
d
final
void
registerMouseListener
(
final
ActionGroup
group
)
{
pr
iva
te
final
void
registerMouseListener
(
final
ActionGroup
group
)
{
myFileSystemTree
.
registerMouseListener
(
group
);
}
...
...
@@ -560,7 +557,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
if
(
contents
!=
null
)
{
final
List
<
File
>
fileList
=
FileCopyPasteUtil
.
getFileList
(
contents
);
if
(
fileList
!=
null
)
{
if
(
fileList
.
size
()
>
0
)
{
if
(
!
fileList
.
isEmpty
()
)
{
return
fileList
.
get
(
0
).
getAbsolutePath
();
}
}
...
...
@@ -631,7 +628,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
if
(!
isToShowTextField
()
||
myTreeIsUpdating
)
return
;
String
text
=
""
;
if
(
selection
.
size
()
>
0
)
{
if
(
!
selection
.
isEmpty
()
)
{
text
=
VfsUtil
.
getReadableUrl
(
selection
.
get
(
0
));
}
else
{
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileChooserFactoryImpl.java
+
4
-
2
View file @
d2cc6528
...
...
@@ -115,12 +115,14 @@ public class FileChooserFactoryImpl extends FileChooserFactory {
@NotNull
@Override
public
FileSaverDialog
createSaveFileDialog
(
@NotNull
FileSaverDescriptor
descriptor
,
@Nullable
Project
project
)
{
return
(
SystemInfo
.
isMac
&&
Registry
.
is
(
"ide.mac.native.save.dialog"
))
?
new
MacFileSaverDialog
(
descriptor
,
project
)
:
new
FileSaverDialogImpl
(
descriptor
,
project
);
return
SystemInfo
.
isMac
&&
Registry
.
is
(
"ide.mac.native.save.dialog"
)
?
new
MacFileSaverDialog
(
descriptor
,
project
)
:
new
FileSaverDialogImpl
(
descriptor
,
project
);
}
@NotNull
@Override
public
FileSaverDialog
createSaveFileDialog
(
@NotNull
FileSaverDescriptor
descriptor
,
@NotNull
Component
parent
)
{
return
(
SystemInfo
.
isMac
&&
Registry
.
is
(
"ide.mac.native.save.dialog"
))?
new
MacFileSaverDialog
(
descriptor
,
parent
)
:
new
FileSaverDialogImpl
(
descriptor
,
parent
);
return
SystemInfo
.
isMac
&&
Registry
.
is
(
"ide.mac.native.save.dialog"
)
?
new
MacFileSaverDialog
(
descriptor
,
parent
)
:
new
FileSaverDialogImpl
(
descriptor
,
parent
);
}
}
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/fileChooser/impl/FileTreeStructure.java
+
3
-
2
View file @
d2cc6528
...
...
@@ -117,7 +117,8 @@ public class FileTreeStructure extends AbstractTreeStructure {
final
FileElement
fileElement
=
(
FileElement
)
element
;
final
VirtualFile
elementFile
=
getValidFile
(
fileElement
);
if
(
elementFile
!=
null
&&
myRootElement
.
getFile
()
!=
null
&&
myRootElement
.
getFile
().
equals
(
elementFile
))
{
VirtualFile
rootElementFile
=
myRootElement
.
getFile
();
if
(
rootElementFile
!=
null
&&
rootElementFile
.
equals
(
elementFile
))
{
return
null
;
}
...
...
@@ -138,7 +139,7 @@ public class FileTreeStructure extends AbstractTreeStructure {
parent
=
LocalFileSystem
.
getInstance
().
findFileByPath
(
localPath
);
}
if
(
parent
!=
null
&&
parent
.
isValid
()
&&
parent
.
equals
(
myR
ootElement
.
get
File
()
))
{
if
(
parent
!=
null
&&
parent
.
isValid
()
&&
parent
.
equals
(
r
ootElementFile
))
{
return
myRootElement
;
}
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java
+
2
-
1
View file @
d2cc6528
...
...
@@ -27,6 +27,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import
com.intellij.openapi.vfs.newvfs.persistent.PersistentFS
;
import
com.intellij.openapi.vfs.newvfs.persistent.RefreshWorker
;
import
com.intellij.util.concurrency.Semaphore
;
import
com.intellij.util.containers.ContainerUtil
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
...
...
@@ -153,7 +154,7 @@ public class RefreshSessionImpl extends RefreshSession {
count
++;
if
(
LOG
.
isTraceEnabled
())
LOG
.
trace
(
"events="
+
myEvents
.
size
());
}
while
(!
myCancelled
&&
myIsRecursive
&&
count
<
3
&&
workQueue
.
stream
().
anyMatch
(
f
->
((
NewVirtualFile
)
f
).
isDirty
()));
while
(!
myCancelled
&&
myIsRecursive
&&
count
<
3
&&
ContainerUtil
.
exists
(
workQueue
,
f
->
((
NewVirtualFile
)
f
).
isDirty
()));
if
(
t
!=
0
)
{
t
=
System
.
currentTimeMillis
()
-
t
;
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/ui/mac/MacPathChooserDialog.java
+
1
-
1
View file @
d2cc6528
...
...
@@ -63,7 +63,7 @@ public class MacPathChooserDialog implements PathChooserDialog, FileChooserDialo
}
@Override
public
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
Consumer
<
List
<
VirtualFile
>>
callback
)
{
public
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
Consumer
<
?
super
List
<
VirtualFile
>>
callback
)
{
if
(
toSelect
!=
null
&&
toSelect
.
getParent
()
!=
null
)
{
String
directoryName
;
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/ui/win/WinPathChooserDialog.java
+
1
-
1
View file @
d2cc6528
...
...
@@ -62,7 +62,7 @@ public class WinPathChooserDialog implements PathChooserDialog, FileChooserDialo
}
@Override
public
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
Consumer
<
List
<
VirtualFile
>>
callback
)
{
public
void
choose
(
@Nullable
VirtualFile
toSelect
,
@NotNull
Consumer
<
?
super
List
<
VirtualFile
>>
callback
)
{
if
(
toSelect
!=
null
&&
toSelect
.
getParent
()
!=
null
)
{
String
directoryName
;
...
...
This diff is collapsed.
Click to expand it.
platform/util/src/com/intellij/util/indexing/impl/ValueContainerImpl.java
+
93
-
89
View file @
d2cc6528
...
...
@@ -42,7 +42,7 @@ import java.util.Map;
*/
class
ValueContainerImpl
<
Value
>
extends
UpdatableValueContainer
<
Value
>
implements
Cloneable
{
private
static
final
Logger
LOG
=
Logger
.
getInstance
(
"#com.intellij.util.indexing.impl.ValueContainerImpl"
);
private
final
static
Object
myNullValue
=
new
Object
();
private
static
final
Object
myNullValue
=
new
Object
();
// there is no volatile as we modify under write lock and read under read lock
// Most often (80%) we store 0 or one mapping, then we store them in two fields: myInputIdMapping, myInputIdMappingValue
...
...
@@ -168,98 +168,100 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
@NotNull
@Override
public
InvertedIndexValueIterator
<
Value
>
getValueIterator
()
{
if
(
myInputIdMapping
!=
null
)
{
final
THashMap
<
Value
,
Object
>
mapping
=
asMapping
();
if
(
mapping
==
null
)
{
return
new
InvertedIndexValueIterator
<
Value
>()
{
private
Value
value
=
(
Value
)
myInputIdMapping
;
if
(
myInputIdMapping
==
null
)
{
//noinspection unchecked
return
EmptyValueIterator
.
INSTANCE
;
}
final
THashMap
<
Value
,
Object
>
mapping
=
asMapping
();
if
(
mapping
==
null
)
{
return
new
InvertedIndexValueIterator
<
Value
>()
{
private
Value
value
=
(
Value
)
myInputIdMapping
;
@NotNull
@Override
public
ValueContainer
.
IntIterator
getInputIdsIterator
()
{
return
getIntIteratorOutOfFileSetObject
(
getFileSetObject
());
}
@NotNull
@Override
public
IntIterator
getInputIdsIterator
()
{
return
getIntIteratorOutOfFileSetObject
(
getFileSetObject
());
}
@NotNull
@Override
public
IntPredicate
getValueAssociationPredicate
()
{
return
getPredicateOutOfFileSetObject
(
getFileSetObject
());
}
@NotNull
@Override
public
IntPredicate
getValueAssociationPredicate
()
{
return
getPredicateOutOfFileSetObject
(
getFileSetObject
());
}
@Override
public
Object
getFileSetObject
()
{
return
myInputIdMappingValue
;
}
@Override
public
Object
getFileSetObject
()
{
return
myInputIdMappingValue
;
}
@Override
public
boolean
hasNext
()
{
return
value
!=
null
;
}
@Override
public
boolean
hasNext
()
{
return
value
!=
null
;
}
@Override
public
Value
next
()
{
Value
next
=
value
;
if
(
next
==
myNullValue
)
next
=
null
;
value
=
null
;
return
next
;
}
@Override
public
Value
next
()
{
Value
next
=
value
;
if
(
next
==
myNullValue
)
next
=
null
;
value
=
null
;
return
next
;
}
@Override
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
};
}
else
{
return
new
InvertedIndexValueIterator
<
Value
>()
{
private
Value
current
;
private
Object
currentValue
;
private
final
Iterator
<
Map
.
Entry
<
Value
,
Object
>>
iterator
=
mapping
.
entrySet
().
iterator
();
@Override
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
};
}
else
{
return
new
InvertedIndexValueIterator
<
Value
>()
{
private
Value
current
;
private
Object
currentValue
;
private
final
Iterator
<
Map
.
Entry
<
Value
,
Object
>>
iterator
=
mapping
.
entrySet
().
iterator
();
@Override
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
@Override
public
boolean
hasNext
()
{
return
iterator
.
hasNext
();
}
@Override
public
Value
next
()
{
Map
.
Entry
<
Value
,
Object
>
entry
=
iterator
.
next
();
current
=
entry
.
getKey
();
Value
next
=
current
;
currentValue
=
entry
.
getValue
();
if
(
next
==
myNullValue
)
next
=
null
;
return
next
;
}
@Override
public
Value
next
()
{
Map
.
Entry
<
Value
,
Object
>
entry
=
iterator
.
next
();
current
=
entry
.
getKey
();
Value
next
=
current
;
currentValue
=
entry
.
getValue
();
if
(
next
==
myNullValue
)
next
=
null
;
return
next
;
}
@Override
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
remove
()
{
throw
new
UnsupportedOperationException
();
}
@NotNull
@Override
public
ValueContainer
.
IntIterator
getInputIdsIterator
()
{
return
getIntIteratorOutOfFileSetObject
(
getFileSetObject
());
}
@NotNull
@Override
public
IntIterator
getInputIdsIterator
()
{
return
getIntIteratorOutOfFileSetObject
(
getFileSetObject
());
}
@NotNull
@Override
public
IntPredicate
getValueAssociationPredicate
()
{
return
getPredicateOutOfFileSetObject
(
getFileSetObject
());
}
@NotNull
@Override
public
IntPredicate
getValueAssociationPredicate
()
{
return
getPredicateOutOfFileSetObject
(
getFileSetObject
());
}
@Override
public
Object
getFileSetObject
()
{
if
(
current
==
null
)
throw
new
IllegalStateException
();
return
currentValue
;
}
};
}
}
else
{
return
emptyIterator
;
@Override
public
Object
getFileSetObject
()
{
if
(
current
==
null
)
throw
new
IllegalStateException
();
return
currentValue
;
}
};
}
}
static
class
EmptyValueIterator
<
Value
>
extends
EmptyIterator
<
Value
>
implements
InvertedIndexValueIterator
<
Value
>
{
private
static
class
EmptyValueIterator
<
Value
>
extends
EmptyIterator
<
Value
>
implements
InvertedIndexValueIterator
<
Value
>
{
private
static
final
EmptyValueIterator
INSTANCE
=
new
EmptyValueIterator
();
@NotNull
@Override
...
...
@@ -279,9 +281,8 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
}
}
private
static
final
EmptyValueIterator
emptyIterator
=
new
EmptyValueIterator
();
private
static
@NotNull
IntPredicate
getPredicateOutOfFileSetObject
(
@Nullable
Object
input
)
{
@NotNull
private
static
IntPredicate
getPredicateOutOfFileSetObject
(
@Nullable
Object
input
)
{
if
(
input
==
null
)
return
EMPTY_PREDICATE
;
if
(
input
instanceof
Integer
)
{
...
...
@@ -297,14 +298,14 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
return
((
ChangeBufferingList
)
input
).
intPredicate
();
}
private
static
@NotNull
@NotNull
private
static
ValueContainer
.
IntIterator
getIntIteratorOutOfFileSetObject
(
@Nullable
Object
input
)
{
if
(
input
==
null
)
return
EMPTY_ITERATOR
;
if
(
input
instanceof
Integer
){
if
(
input
instanceof
Integer
)
{
return
new
SingleValueIterator
(((
Integer
)
input
).
intValue
());
}
else
{
return
((
ChangeBufferingList
)
input
).
intIterator
();
}
return
((
ChangeBufferingList
)
input
).
intIterator
();
}
private
Object
getFileSetObject
(
Value
value
)
{
...
...
@@ -378,7 +379,8 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
}
};
private
@Nullable
ChangeBufferingList
ensureFileSetCapacityForValue
(
Value
value
,
int
count
)
{
@Nullable
private
ChangeBufferingList
ensureFileSetCapacityForValue
(
Value
value
,
int
count
)
{
if
(
count
<=
1
)
return
null
;
Object
fileSetObject
=
getFileSetObject
(
value
);
...
...
@@ -388,7 +390,8 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
list
.
add
(((
Integer
)
fileSetObject
).
intValue
());
resetFileSetForValue
(
value
,
list
);
return
list
;
}
else
if
(
fileSetObject
instanceof
ChangeBufferingList
)
{
}
if
(
fileSetObject
instanceof
ChangeBufferingList
)
{
ChangeBufferingList
list
=
(
ChangeBufferingList
)
fileSetObject
;
list
.
ensureCapacity
(
count
);
return
list
;
...
...
@@ -412,7 +415,8 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
myInputIdMappingValue
=
null
;
}
mapping
.
put
(
value
,
fileSet
);
}
else
{
}
else
{
myInputIdMapping
=
value
;
myInputIdMappingValue
=
fileSet
;
}
...
...
@@ -504,7 +508,7 @@ class ValueContainerImpl<Value> extends UpdatableValueContainer<Value> implement
private
static
class
SingleValueIterator
implements
IntIdsIterator
{
private
final
int
myValue
;
private
boolean
myValueRead
=
false
;
private
boolean
myValueRead
;
private
SingleValueIterator
(
int
value
)
{
myValue
=
value
;
...
...
This diff is collapsed.
Click to expand it.
spellchecker/src/com/intellij/spellchecker/settings/CustomDictionariesPanel.java
+
1
-
1
View file @
d2cc6528
...
...
@@ -91,7 +91,7 @@ public class CustomDictionariesPanel extends JPanel {
this
.
add
(
decorator
.
createPanel
(),
BorderLayout
.
CENTER
);
}
private
void
doChooseFiles
(
@NotNull
Project
project
,
@NotNull
Consumer
<
List
<
VirtualFile
>>
consumer
)
{
private
void
doChooseFiles
(
@NotNull
Project
project
,
@NotNull
Consumer
<
?
super
List
<
VirtualFile
>>
consumer
)
{
final
FileChooserDescriptor
fileChooserDescriptor
=
new
FileChooserDescriptor
(
true
,
false
,
false
,
false
,
false
,
true
)
{
@Override
public
boolean
isFileSelectable
(
VirtualFile
file
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help