Skip to content

Commit

Permalink
Do not try to copy references in dumb mode
Browse files Browse the repository at this point in the history
 #KT-4766 Fixed
  • Loading branch information
PVTalanov committed Oct 7, 2014
1 parent 23fa0ba commit 1e9718f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions annotations/com/intellij/openapi/project/annotations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<root>
<item
name='com.intellij.openapi.project.DumbService com.intellij.openapi.project.DumbService getInstance(com.intellij.openapi.project.Project)'>
<annotation name='org.jetbrains.annotations.NotNull'/>
</item>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ import org.jetbrains.jet.lang.resolve.descriptorUtil.isExtension
public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<ReferenceTransferableData>() {

override fun extractTransferableData(content: Transferable): List<ReferenceTransferableData> {
if (CodeInsightSettings.getInstance()!!.ADD_IMPORTS_ON_PASTE != CodeInsightSettings.NO) {
if (CodeInsightSettings.getInstance().ADD_IMPORTS_ON_PASTE != CodeInsightSettings.NO) {
try {
val flavor = ReferenceData.getDataFlavor()
if (flavor != null) {
Expand All @@ -94,7 +94,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Refere
startOffsets: IntArray,
endOffsets: IntArray
): List<ReferenceTransferableData> {
if (file !is JetFile) {
if (file !is JetFile || DumbService.getInstance(file.getProject()).isDumb()) {
return listOf()
}

Expand Down Expand Up @@ -184,7 +184,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Refere
indented: Ref<Boolean>,
values: List<ReferenceTransferableData>
) {
if (DumbService.getInstance(project)!!.isDumb()) {
if (DumbService.getInstance(project).isDumb()) {
return
}
val document = editor.getDocument()
Expand Down Expand Up @@ -289,7 +289,7 @@ public class KotlinCopyPasteReferenceProcessor() : CopyPastePostProcessor<Refere
}

private fun showRestoreReferencesDialog(project: Project, referencesToRestore: List<ReferenceToRestoreData>): Collection<ReferenceToRestoreData> {
val shouldShowDialog = CodeInsightSettings.getInstance()!!.ADD_IMPORTS_ON_PASTE == CodeInsightSettings.ASK
val shouldShowDialog = CodeInsightSettings.getInstance().ADD_IMPORTS_ON_PASTE == CodeInsightSettings.ASK
if (!shouldShowDialog || referencesToRestore.isEmpty()) {
return referencesToRestore
}
Expand Down

0 comments on commit 1e9718f

Please sign in to comment.