From 6200195a07e8607fa0450d46b4a3e561f6252cb5 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 6 Feb 2014 13:30:12 +0400 Subject: [PATCH] split DuplicatesProfile into index part and presentation part introduce duplicates-analysis-* modules independent on platform-* or lang-* modules, suitable for Upsource --- .../src/com/intellij/usageView/UsageInfo.java | 16 +++++----------- .../favoritesTreeView/UsageProjectTreeNode.java | 7 ++++--- .../com/intellij/usageView/UsageViewUtil.java | 10 +++++++++- .../com/intellij/usages/impl/UsageViewImpl.java | 2 ++ python/src/META-INF/python-core.xml | 1 + 5 files changed, 21 insertions(+), 15 deletions(-) rename platform/{lang-api => core-api}/src/com/intellij/usageView/UsageInfo.java (94%) diff --git a/platform/lang-api/src/com/intellij/usageView/UsageInfo.java b/platform/core-api/src/com/intellij/usageView/UsageInfo.java similarity index 94% rename from platform/lang-api/src/com/intellij/usageView/UsageInfo.java rename to platform/core-api/src/com/intellij/usageView/UsageInfo.java index 47a9958a871c..77e63a93105f 100644 --- a/platform/lang-api/src/com/intellij/usageView/UsageInfo.java +++ b/platform/core-api/src/com/intellij/usageView/UsageInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,6 @@ package com.intellij.usageView; import com.intellij.lang.injection.InjectedLanguageManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; -import com.intellij.openapi.fileEditor.FileEditorManager; -import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.ProperTextRange; import com.intellij.openapi.util.Segment; @@ -91,6 +89,7 @@ public class UsageInfo { mySmartPointer = smartPointer; } + @NotNull public SmartPsiElementPointer getSmartPointer() { return mySmartPointer; } @@ -172,17 +171,10 @@ public class UsageInfo { /** * Override this method if you want a tooltip to be displayed for this usage */ - public String getTooltipText () { + public String getTooltipText() { return null; } - public final void navigateTo(boolean requestFocus) { - int offset = getNavigationOffset(); - VirtualFile file = getVirtualFile(); - Project project = getProject(); - FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, file, offset), requestFocus); - } - public int getNavigationOffset() { if (myPsiFileRange != null) { final Segment range = myPsiFileRange.getRange(); @@ -233,6 +225,7 @@ public class UsageInfo { return element == null || element.isWritable(); } + @Override public boolean equals(Object o) { if (this == o) return true; if (!getClass().equals(o.getClass())) return false; @@ -246,6 +239,7 @@ public class UsageInfo { && (myPsiFileRange == null || usageInfo.myPsiFileRange != null && smartPointerManager.pointToTheSameElement(myPsiFileRange, usageInfo.myPsiFileRange)); } + @Override public int hashCode() { int result = mySmartPointer != null ? mySmartPointer.hashCode() : 0; result = 29 * result + (myPsiFileRange == null ? 0 : myPsiFileRange.hashCode()); diff --git a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java index 2a724b05fbb1..279cea934cc0 100644 --- a/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.java +++ b/platform/lang-impl/src/com/intellij/ide/favoritesTreeView/UsageProjectTreeNode.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.util.text.StringUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiElement; import com.intellij.usageView.UsageInfo; +import com.intellij.usageView.UsageViewUtil; import com.intellij.usages.TextChunk; import com.intellij.usages.UsageInfo2UsageAdapter; import com.intellij.usages.UsagePresentation; @@ -78,12 +79,12 @@ public class UsageProjectTreeNode extends ProjectViewNodeWithChildrenList + com.jetbrains.python.codeInsight.intentions.PyConvertMethodToPropertyIntention