mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
split DuplicatesProfile into index part and presentation part
introduce duplicates-analysis-* modules independent on platform-* or lang-* modules, suitable for Upsource
This commit is contained in:
+5
-11
@@ -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());
|
||||
@@ -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<UsageI
|
||||
|
||||
@Override
|
||||
public void navigate(boolean requestFocus) {
|
||||
getValue().navigateTo(requestFocus);
|
||||
UsageViewUtil.navigateTo(getValue(), requestFocus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canNavigate() {
|
||||
return getValue().getElement().isValid();
|
||||
return canNavigateToSource();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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,6 +18,8 @@ package com.intellij.usageView;
|
||||
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.GeneratedSourcesFilter;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -155,4 +157,10 @@ public class UsageViewUtil {
|
||||
});
|
||||
}
|
||||
|
||||
public static void navigateTo(@NotNull UsageInfo info, boolean requestFocus) {
|
||||
int offset = info.getNavigationOffset();
|
||||
VirtualFile file = info.getVirtualFile();
|
||||
Project project = info.getProject();
|
||||
FileEditorManager.getInstance(project).openTextEditor(new OpenFileDescriptor(project, file, offset), requestFocus);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
|
||||
@@ -133,6 +133,7 @@
|
||||
|
||||
<joinLinesHandler implementation="com.jetbrains.python.editor.PyJoinLinesHandler"/>
|
||||
<duplicates.profile implementation="com.jetbrains.python.duplocator.PyDuplicatesProfile"/>
|
||||
<duplicates.presentation implementation="com.jetbrains.python.duplocator.PyDuplicatesProfile"/>
|
||||
|
||||
<intentionAction>
|
||||
<className>com.jetbrains.python.codeInsight.intentions.PyConvertMethodToPropertyIntention</className>
|
||||
|
||||
Reference in New Issue
Block a user