mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-119615 Find in path mixes "occurrences" and "usages" terminology
This commit is contained in:
@@ -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.ui.Splitter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.PsiSubstitutor;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiFormatUtilBase;
|
||||
import com.intellij.refactoring.HelpID;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.safeDelete.usageInfo.SafeDeleteOverridingMethodUsageInfo;
|
||||
@@ -30,6 +31,7 @@ import com.intellij.ui.BooleanTableCellRenderer;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.TableUtil;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.usages.impl.UsagePreviewPanel;
|
||||
import com.intellij.util.ui.Table;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -72,12 +74,12 @@ class OverridingMethodsDialog extends DialogWrapper {
|
||||
for (int i = 0; i < myMethodText.length; i++) {
|
||||
myMethodText[i] = PsiFormatUtil.formatMethod(
|
||||
((SafeDeleteOverridingMethodUsageInfo) myOverridingMethods.get(i)).getOverridingMethod(),
|
||||
PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_CONTAINING_CLASS
|
||||
| PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS | PsiFormatUtil.SHOW_TYPE,
|
||||
PsiFormatUtil.SHOW_TYPE
|
||||
PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_CONTAINING_CLASS
|
||||
| PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS | PsiFormatUtilBase.SHOW_TYPE,
|
||||
PsiFormatUtilBase.SHOW_TYPE
|
||||
);
|
||||
}
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(project);
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(project, new UsageViewPresentation());
|
||||
setTitle(RefactoringBundle.message("unused.overriding.methods.title"));
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -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,6 +37,7 @@ import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.Usage;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.usages.UsageViewSettings;
|
||||
import com.intellij.usages.impl.UsagePreviewPanel;
|
||||
import com.intellij.util.EditSourceOnDoubleClickHandler;
|
||||
@@ -156,7 +157,7 @@ public abstract class SlicePanel extends JPanel implements TypeSafeDataProvider,
|
||||
boolean vertical = myToolWindow.getAnchor() == ToolWindowAnchor.LEFT || myToolWindow.getAnchor() == ToolWindowAnchor.RIGHT;
|
||||
Splitter splitter = new Splitter(vertical, UsageViewSettings.getInstance().PREVIEW_USAGES_SPLITTER_PROPORTIONS);
|
||||
splitter.setFirstComponent(pane);
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(myProject);
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(myProject, new UsageViewPresentation());
|
||||
myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
|
||||
|
||||
Disposer.register(this, myUsagePreviewPanel);
|
||||
|
||||
@@ -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 @@ package com.intellij.usageView;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.usages.UsageContextPanel;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.usages.impl.UsageViewImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class UsageContextDataflowFromPanel extends UsageContextDataflowToPanel {
|
||||
@NotNull
|
||||
@Override
|
||||
public UsageContextPanel create(@NotNull UsageView usageView) {
|
||||
return new UsageContextDataflowFromPanel(((UsageViewImpl)usageView).getProject());
|
||||
return new UsageContextDataflowFromPanel(((UsageViewImpl)usageView).getProject(), usageView.getPresentation());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -37,8 +38,8 @@ public class UsageContextDataflowFromPanel extends UsageContextDataflowToPanel {
|
||||
}
|
||||
}
|
||||
|
||||
public UsageContextDataflowFromPanel(@NotNull Project project) {
|
||||
super(project);
|
||||
public UsageContextDataflowFromPanel(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
super(project, presentation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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,10 +28,7 @@ import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiJavaFile;
|
||||
import com.intellij.psi.PsiVariable;
|
||||
import com.intellij.slicer.*;
|
||||
import com.intellij.usages.PsiElementUsageTarget;
|
||||
import com.intellij.usages.UsageContextPanel;
|
||||
import com.intellij.usages.UsageTarget;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.usages.impl.UsageContextPanelBase;
|
||||
import com.intellij.usages.impl.UsageViewImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -42,13 +39,14 @@ import java.awt.*;
|
||||
import java.util.List;
|
||||
|
||||
public class UsageContextDataflowToPanel extends UsageContextPanelBase {
|
||||
@NotNull private final UsageViewPresentation myPresentation;
|
||||
private JComponent myPanel;
|
||||
|
||||
public static class Provider implements UsageContextPanel.Provider {
|
||||
@NotNull
|
||||
@Override
|
||||
public UsageContextPanel create(@NotNull UsageView usageView) {
|
||||
return new UsageContextDataflowToPanel(((UsageViewImpl)usageView).getProject());
|
||||
return new UsageContextDataflowToPanel(((UsageViewImpl)usageView).getProject(), usageView.getPresentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,8 +68,9 @@ public class UsageContextDataflowToPanel extends UsageContextPanelBase {
|
||||
}
|
||||
}
|
||||
|
||||
public UsageContextDataflowToPanel(@NotNull Project project) {
|
||||
super(project);
|
||||
public UsageContextDataflowToPanel(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
super(project, presentation);
|
||||
myPresentation = presentation;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,7 +83,7 @@ public class UsageContextDataflowToPanel extends UsageContextPanelBase {
|
||||
public void updateLayoutLater(@Nullable final List<UsageInfo> infos) {
|
||||
if (infos == null) {
|
||||
removeAll();
|
||||
JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview"), SwingConstants.CENTER);
|
||||
JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview", myPresentation.getUsagesWord()), SwingConstants.CENTER);
|
||||
add(titleComp, BorderLayout.CENTER);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
@@ -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,7 +21,6 @@ import com.intellij.find.impl.FindInProjectUtil;
|
||||
import com.intellij.find.replaceInProject.ReplaceInProjectManager;
|
||||
import com.intellij.lang.properties.IProperty;
|
||||
import com.intellij.lang.properties.psi.PropertiesFile;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.command.CommandProcessor;
|
||||
@@ -49,6 +48,7 @@ import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.ThrowableRunnable;
|
||||
import com.intellij.util.WaitFor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -185,11 +185,11 @@ public class FindManagerTest extends DaemonAnalyzerTestCase {
|
||||
assertEquals(expectedResults, usages.size());
|
||||
}
|
||||
|
||||
private List<UsageInfo> findUsages(final FindModel findModel) {
|
||||
private List<UsageInfo> findUsages(@NotNull FindModel findModel) {
|
||||
PsiDirectory psiDirectory = FindInProjectUtil.getPsiDirectory(findModel, myProject);
|
||||
List<UsageInfo> result = new ArrayList<UsageInfo>();
|
||||
final CommonProcessors.CollectProcessor<UsageInfo> collector = new CommonProcessors.CollectProcessor<UsageInfo>(result);
|
||||
FindInProjectUtil.findUsages(findModel, psiDirectory, myProject, true, collector, new FindUsagesProcessPresentation());
|
||||
FindInProjectUtil.findUsages(findModel, psiDirectory, myProject, true, collector, new FindUsagesProcessPresentation(FindInProjectUtil.setupViewPresentation(true, findModel)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,7 +55,7 @@ public class UsageViewBundle {
|
||||
return " (" + message("occurence.info.reference", usagesCount, filesCount) + ")";
|
||||
}
|
||||
|
||||
private static ResourceBundle getBundle() {
|
||||
public static ResourceBundle getBundle() {
|
||||
ResourceBundle bundle = com.intellij.reference.SoftReference.dereference(ourBundle);
|
||||
if (bundle == null) {
|
||||
bundle = ResourceBundle.getBundle(BUNDLE);
|
||||
|
||||
@@ -205,7 +205,7 @@ public class FindInProjectUtil {
|
||||
return Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
|
||||
}
|
||||
|
||||
public static void findUsages(@NotNull final FindModel findModel,
|
||||
public static void findUsages(@NotNull FindModel findModel,
|
||||
final PsiDirectory psiDirectory,
|
||||
@NotNull final Project project,
|
||||
boolean showWarnings,
|
||||
@@ -253,9 +253,10 @@ public class FindInProjectUtil {
|
||||
totalFilesSize += fileLength;
|
||||
if (totalFilesSize > FILES_SIZE_LIMIT && !warningShown[0]) {
|
||||
warningShown[0] = true;
|
||||
String message = FindBundle.message("find.excessive.total.size.prompt", UsageViewManagerImpl.presentableSize(totalFilesSize),
|
||||
String message = FindBundle.message("find.excessive.total.size.prompt",
|
||||
UsageViewManagerImpl.presentableSize(totalFilesSize),
|
||||
ApplicationNamesInfo.getInstance().getProductName());
|
||||
UsageLimitUtil.showAndCancelIfAborted(project, message);
|
||||
UsageLimitUtil.showAndCancelIfAborted(project, message, processPresentation.getUsageViewPresentation());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -656,6 +657,8 @@ public class FindInProjectUtil {
|
||||
presentation.setTabText(FindBundle.message("find.usage.view.tab.text", stringToFind));
|
||||
presentation.setToolwindowTitle(FindBundle.message("find.usage.view.toolwindow.title", stringToFind, scope));
|
||||
presentation.setUsagesString(FindBundle.message("find.usage.view.usages.text", stringToFind));
|
||||
presentation.setUsagesWord(FindBundle.message("occurrence"));
|
||||
presentation.setCodeUsagesString(FindBundle.message("found.occurrences"));
|
||||
}
|
||||
presentation.setOpenInNewTab(toOpenInNewTab);
|
||||
presentation.setCodeUsages(false);
|
||||
@@ -667,7 +670,7 @@ public class FindInProjectUtil {
|
||||
public static FindUsagesProcessPresentation setupProcessPresentation(final Project project,
|
||||
final boolean showPanelIfOnlyOneUsage,
|
||||
@NotNull final UsageViewPresentation presentation) {
|
||||
FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation();
|
||||
FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
|
||||
processPresentation.setShowNotFoundMessage(true);
|
||||
processPresentation.setShowPanelIfOnlyOneUsage(showPanelIfOnlyOneUsage);
|
||||
processPresentation.setProgressIndicatorFactory(
|
||||
|
||||
@@ -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,8 @@
|
||||
|
||||
package com.intellij.ide.todo;
|
||||
|
||||
import com.intellij.find.FindModel;
|
||||
import com.intellij.find.impl.FindInProjectUtil;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.*;
|
||||
import com.intellij.ide.actions.ContextHelpAction;
|
||||
@@ -151,7 +153,7 @@ abstract class TodoPanel extends SimpleToolWindowPanel implements OccurenceNavig
|
||||
);
|
||||
|
||||
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(myProject);
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(myProject, FindInProjectUtil.setupViewPresentation(false, new FindModel()));
|
||||
myUsagePreviewPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.LEFT));
|
||||
Disposer.register(this, myUsagePreviewPanel);
|
||||
myUsagePreviewPanel.setVisible(mySettings.isShowPreview());
|
||||
|
||||
@@ -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.
|
||||
@@ -1698,7 +1698,7 @@ public abstract class ChooseByNameBase {
|
||||
protected boolean isOverflow(@NotNull Set<Object> elementsArray) {
|
||||
if (elementsArray.size() > UsageLimitUtil.USAGES_LIMIT - myMaximumListSizeLimit && !userAskedToAbort.getAndSet(true)) {
|
||||
final UsageLimitUtil.Result ret = UsageLimitUtil.showTooManyUsagesWarning(myProject, UsageViewBundle
|
||||
.message("find.excessive.usage.count.prompt", elementsArray.size() + myMaximumListSizeLimit));
|
||||
.message("find.excessive.usage.count.prompt", elementsArray.size() + myMaximumListSizeLimit, StringUtil.pluralize(presentation.getUsagesWord())), presentation);
|
||||
if (ret == UsageLimitUtil.Result.ABORT) {
|
||||
overFlow[0] = true;
|
||||
return true;
|
||||
|
||||
@@ -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.
|
||||
@@ -39,6 +39,7 @@ import com.intellij.ui.PopupHandler;
|
||||
import com.intellij.ui.TableUtil;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.usages.impl.UsagePreviewPanel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -83,7 +84,7 @@ public class AutomaticRenamingDialog extends DialogWrapper {
|
||||
super(project, true);
|
||||
myProject = project;
|
||||
myRenamer = renamer;
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(myProject);
|
||||
myUsagePreviewPanel = new UsagePreviewPanel(myProject, new UsageViewPresentation());
|
||||
myUsageFileLabel = new JLabel();
|
||||
populateData();
|
||||
myTableModel = new MyTableModel(renamer.allowChangeSuggestedName());
|
||||
|
||||
+6
-9
@@ -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.
|
||||
@@ -28,10 +28,7 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.PsiElementUsageTarget;
|
||||
import com.intellij.usages.UsageContextPanel;
|
||||
import com.intellij.usages.UsageTarget;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.usages.*;
|
||||
import com.intellij.usages.impl.UsageContextPanelBase;
|
||||
import com.intellij.usages.impl.UsageViewImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -48,7 +45,7 @@ public class UsageContextCallHierarchyPanel extends UsageContextPanelBase {
|
||||
@NotNull
|
||||
@Override
|
||||
public UsageContextPanel create(@NotNull UsageView usageView) {
|
||||
return new UsageContextCallHierarchyPanel(((UsageViewImpl)usageView).getProject());
|
||||
return new UsageContextCallHierarchyPanel(((UsageViewImpl)usageView).getProject(), usageView.getPresentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,8 +72,8 @@ public class UsageContextCallHierarchyPanel extends UsageContextPanelBase {
|
||||
}
|
||||
}
|
||||
|
||||
public UsageContextCallHierarchyPanel(@NotNull Project project) {
|
||||
super(project);
|
||||
public UsageContextCallHierarchyPanel(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
super(project, presentation);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,7 +98,7 @@ public class UsageContextCallHierarchyPanel extends UsageContextPanelBase {
|
||||
|
||||
removeAll();
|
||||
if (element == null) {
|
||||
JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview"), SwingConstants.CENTER);
|
||||
JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview", myPresentation.getUsagesWord()), SwingConstants.CENTER);
|
||||
add(titleComp, BorderLayout.CENTER);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ remove.element.fix.name=Remove <{0}> element
|
||||
remove.attribute.fix.name=Remove "{0}" attribute
|
||||
|
||||
message.invalid.value.quotation=Bad quotation for ''{0}''
|
||||
dom.usage.type=Usage in XML descriptor
|
||||
dom.usage.type={0} in XML descriptor
|
||||
|
||||
create.new.element=Create new {0} ''{1}''
|
||||
choose.file=Choose file
|
||||
|
||||
@@ -97,7 +97,7 @@ find.origin.from.cursor.radio=Fro&m cursor
|
||||
find.origin.entire.scope.radio=E&ntire scope
|
||||
find.searching.for.string.in.file.progress=Searching for ''{0}'' in {1}...
|
||||
find.searching.for.string.in.file.occurrences.progress={0,choice,0#No|1#{0}} {0,choice,0#occurrences|1#occurrence|2#occurrences} found so far
|
||||
find.excessive.total.size.prompt=Usages in files of total size {0} found. {1} may become unresponsive or even fail with OutOfMemoryError if you continue. Continue?
|
||||
find.excessive.total.size.prompt=Occurrences in files of total size {0} found. {1} may become unresponsive or even fail with OutOfMemoryError if you continue. Continue?
|
||||
find.progress.search.completed=Search completed
|
||||
find.scope.project.title=Project
|
||||
find.scope.module.title=Module ''{0}''
|
||||
@@ -124,3 +124,5 @@ find.replace.occurrences.in.read.only.files.title=Read-only Files Found
|
||||
find.scope.custom.radio=Cu&stom:
|
||||
find.usages.ambiguous.title=Find Usages Of {0}
|
||||
0.occurrences.replaced={0,choice,0#No|1#{0}} {0,choice,0#occurrences|1#occurrence|2#occurrences} replaced
|
||||
found.occurrences=Found Occurrences
|
||||
occurrence=occurrence
|
||||
@@ -44,7 +44,7 @@ usage.type.catch.declaration=Catch clause parameter declaration
|
||||
usage.type.return=Method return type
|
||||
usage.type.string.constant=Usage in string constants
|
||||
usage.type.comment=Usage in comments
|
||||
usage.type.unclassified=Unclassified usage
|
||||
usage.type.unclassified=Unclassified {0}
|
||||
occurence.info.usage={0,choice, 0#Not Found|1#1 usage|2#{0,number} usages}{1,choice, 0#|1# in 1 file|2# in {1,number} files}
|
||||
occurence.info.occurence={0,choice, 0#Not Found|1#1 occurrence|2#{0,number} occurrences}{1,choice, 0#|1# in 1 file|2# in {1,number} files}
|
||||
occurence.info.reference={0,choice, 0#Not Found|1#1 reference|2#{0,number} references}{1,choice, 0#|1# in 1 file|2# in {1,number} files}
|
||||
@@ -60,8 +60,8 @@ usage.type.annotation=Annotation
|
||||
usage.type.type.parameter=Type parameter
|
||||
usage.type.read=Value read
|
||||
usage.type.write=Value write
|
||||
preview.usages.action.text=Preview Usages
|
||||
select.the.usage.to.preview=Select the usage to preview
|
||||
preview.usages.action.text=Preview {0}
|
||||
select.the.usage.to.preview=Select {0} to preview
|
||||
usages.were.filtered.out={0,number} {0,choice, 1#usage was|2#usages were} filtered out
|
||||
show.usages.only.usage=It''s the only usage in {0}
|
||||
all.usages.are.in.this.line=All {0} usages in {1} are in this line
|
||||
@@ -69,8 +69,8 @@ no.usages.found.in=No usages found in {0}
|
||||
sort.alphabetically.action.text=Sort Members Alphabetically
|
||||
button.text.continue=Continue
|
||||
button.text.abort=Abort
|
||||
find.excessive.usages.title=Too Many Usages
|
||||
find.excessive.usage.count.prompt={0} usages found so far. Are you sure you wish to continue?
|
||||
find.excessive.usages.title=Too Many {0}
|
||||
find.excessive.usage.count.prompt={0} {1} found so far. Are you sure you wish to continue?
|
||||
find.file.size.megabytes={0} megabytes
|
||||
large.files.were.ignored={0,choice, 0#No|1#1 too large file was ignored|2#{0,number} too large files were ignored}
|
||||
usage.excluded=excluded
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.List;
|
||||
public class FindUsagesProcessPresentation {
|
||||
@NonNls
|
||||
public static final String NAME_WITH_MNEMONIC_KEY = "NameWithMnemonic";
|
||||
private final UsageViewPresentation myUsageViewPresentation;
|
||||
|
||||
private List<Action> myNotFoundActions;
|
||||
private boolean myShowPanelIfOnlyOneUsage;
|
||||
@@ -41,7 +42,8 @@ public class FindUsagesProcessPresentation {
|
||||
private Collection<PsiFile> myLargeFiles;
|
||||
private boolean myShowFindOptionsPrompt = true;
|
||||
|
||||
public FindUsagesProcessPresentation() {
|
||||
public FindUsagesProcessPresentation(@NotNull UsageViewPresentation presentation) {
|
||||
myUsageViewPresentation = presentation;
|
||||
}
|
||||
|
||||
public void addNotFoundAction(@NotNull Action action) {
|
||||
@@ -91,8 +93,14 @@ public class FindUsagesProcessPresentation {
|
||||
return myShowFindOptionsPrompt;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public UsageViewPresentation getUsageViewPresentation() {
|
||||
return myUsageViewPresentation;
|
||||
}
|
||||
|
||||
public void setShowFindOptionsPrompt(boolean showFindOptionsPrompt) {
|
||||
myShowFindOptionsPrompt = showFindOptionsPrompt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -29,8 +30,10 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class UsageLimitUtil {
|
||||
public static final int USAGES_LIMIT = 1000;
|
||||
|
||||
public static void showAndCancelIfAborted(final Project project, final String message) {
|
||||
Result retCode = showTooManyUsagesWarning(project, message);
|
||||
public static void showAndCancelIfAborted(@NotNull Project project,
|
||||
@NotNull String message,
|
||||
@NotNull UsageViewPresentation usageViewPresentation) {
|
||||
Result retCode = showTooManyUsagesWarning(project, message, usageViewPresentation);
|
||||
|
||||
if (retCode != Result.CONTINUE) {
|
||||
throw new ProcessCanceledException();
|
||||
@@ -42,19 +45,23 @@ public class UsageLimitUtil {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Result showTooManyUsagesWarning(@NotNull final Project project, @NotNull final String message) {
|
||||
public static Result showTooManyUsagesWarning(@NotNull final Project project,
|
||||
@NotNull final String message,
|
||||
@NotNull final UsageViewPresentation usageViewPresentation) {
|
||||
final String[] buttons = {UsageViewBundle.message("button.text.continue"), UsageViewBundle.message("button.text.abort")};
|
||||
int result = runOrInvokeAndWait(new Computable<Integer>() {
|
||||
@Override
|
||||
public Integer compute() {
|
||||
return Messages.showOkCancelDialog(project, message, UsageViewBundle.message("find.excessive.usages.title"), buttons[0], buttons[1],
|
||||
String title = UsageViewBundle.message("find.excessive.usages.title", StringUtil.capitalize(StringUtil.pluralize(usageViewPresentation.getUsagesWord())));
|
||||
return Messages.showOkCancelDialog(project, message,
|
||||
title, buttons[0], buttons[1],
|
||||
Messages.getWarningIcon());
|
||||
}
|
||||
});
|
||||
return result == Messages.OK ? Result.CONTINUE : Result.ABORT;
|
||||
}
|
||||
|
||||
private static int runOrInvokeAndWait(final Computable<Integer> f) {
|
||||
private static int runOrInvokeAndWait(@NotNull final Computable<Integer> f) {
|
||||
final int[] answer = new int[1];
|
||||
try {
|
||||
GuiUtils.runOrInvokeAndWait(new Runnable() {
|
||||
|
||||
@@ -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.usages.impl;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.usages.UsageViewSettings;
|
||||
@@ -26,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
*/
|
||||
class PreviewUsageAction extends RuleAction {
|
||||
PreviewUsageAction(@NotNull UsageView usageView) {
|
||||
super(usageView, UsageViewBundle.message("preview.usages.action.text"), AllIcons.Actions.PreviewDetails);
|
||||
super(usageView, UsageViewBundle.message("preview.usages.action.text", StringUtil.capitalize(StringUtil.pluralize(usageView.getPresentation().getUsagesWord()))), AllIcons.Actions.PreviewDetails);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.IdeBorderFactory;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.UsageContextPanel;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -33,10 +34,12 @@ import java.util.List;
|
||||
*/
|
||||
public abstract class UsageContextPanelBase extends JPanel implements UsageContextPanel {
|
||||
protected final Project myProject;
|
||||
@NotNull protected final UsageViewPresentation myPresentation;
|
||||
protected volatile boolean isDisposed;
|
||||
|
||||
public UsageContextPanelBase(@NotNull Project project) {
|
||||
public UsageContextPanelBase(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
myProject = project;
|
||||
myPresentation = presentation;
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(IdeBorderFactory.createBorder());
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -31,6 +31,7 @@ import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.UsageContextPanel;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -45,15 +46,15 @@ public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.usages.impl.UsagePreviewPanel");
|
||||
private Editor myEditor;
|
||||
|
||||
public UsagePreviewPanel(@NotNull Project project) {
|
||||
super(project);
|
||||
public UsagePreviewPanel(@NotNull Project project, @NotNull UsageViewPresentation presentation) {
|
||||
super(project, presentation);
|
||||
}
|
||||
|
||||
public static class Provider implements UsageContextPanel.Provider {
|
||||
@NotNull
|
||||
@Override
|
||||
public UsageContextPanel create(@NotNull UsageView usageView) {
|
||||
return new UsagePreviewPanel(((UsageViewImpl)usageView).getProject());
|
||||
return new UsagePreviewPanel(((UsageViewImpl)usageView).getProject(), usageView.getPresentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,7 +190,7 @@ public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
if (infos == null) {
|
||||
releaseEditor();
|
||||
removeAll();
|
||||
JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview"), SwingConstants.CENTER);
|
||||
JComponent titleComp = new JLabel(UsageViewBundle.message("select.the.usage.to.preview", myPresentation.getUsagesWord()), SwingConstants.CENTER);
|
||||
add(titleComp, BorderLayout.CENTER);
|
||||
revalidate();
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
if (usageCount > UsageLimitUtil.USAGES_LIMIT) {
|
||||
if (tooManyUsagesStatus.switchTooManyUsagesStatus()) {
|
||||
UsageViewManagerImpl
|
||||
.showTooManyUsagesWarning(project, tooManyUsagesStatus, indicator, usageCountWithoutDefinition.get(), UsageViewImpl.this);
|
||||
.showTooManyUsagesWarning(project, tooManyUsagesStatus, indicator, getPresentation(), usageCountWithoutDefinition.get(), UsageViewImpl.this);
|
||||
}
|
||||
}
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
|
||||
@@ -137,7 +137,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
|
||||
@Nullable final UsageViewStateListener listener) {
|
||||
final AtomicReference<UsageViewImpl> usageViewRef = new AtomicReference<UsageViewImpl>();
|
||||
|
||||
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation();
|
||||
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
|
||||
processPresentation.setShowNotFoundMessage(showNotFoundMessage);
|
||||
processPresentation.setShowPanelIfOnlyOneUsage(showPanelIfOnlyOneUsage);
|
||||
|
||||
@@ -238,17 +238,18 @@ public class UsageViewManagerImpl extends UsageViewManager {
|
||||
}
|
||||
|
||||
|
||||
public static void showTooManyUsagesWarning(@NotNull final Project project,
|
||||
@NotNull final TooManyUsagesStatus tooManyUsagesStatus,
|
||||
@NotNull final ProgressIndicator indicator,
|
||||
final int usageCount,
|
||||
final UsageViewImpl usageView) {
|
||||
static void showTooManyUsagesWarning(@NotNull final Project project,
|
||||
@NotNull final TooManyUsagesStatus tooManyUsagesStatus,
|
||||
@NotNull final ProgressIndicator indicator,
|
||||
@NotNull final UsageViewPresentation presentation,
|
||||
final int usageCount,
|
||||
final UsageViewImpl usageView) {
|
||||
UIUtil.invokeLaterIfNeeded(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (usageView != null && usageView.searchHasBeenCancelled() || indicator.isCanceled()) return;
|
||||
String message = UsageViewBundle.message("find.excessive.usage.count.prompt", usageCount);
|
||||
UsageLimitUtil.Result ret = UsageLimitUtil.showTooManyUsagesWarning(project, message);
|
||||
String message = UsageViewBundle.message("find.excessive.usage.count.prompt", usageCount, StringUtil.pluralize(presentation.getUsagesWord()));
|
||||
UsageLimitUtil.Result ret = UsageLimitUtil.showTooManyUsagesWarning(project, message, presentation);
|
||||
if (ret == UsageLimitUtil.Result.ABORT && usageView != null) {
|
||||
usageView.cancelCurrentSearch();
|
||||
indicator.cancel();
|
||||
@@ -366,10 +367,8 @@ public class UsageViewManagerImpl extends UsageViewManager {
|
||||
|
||||
final UsageViewImpl usageView = getUsageView(indicator);
|
||||
|
||||
if (usageCount > UsageLimitUtil.USAGES_LIMIT) {
|
||||
if (tooManyUsagesStatus.switchTooManyUsagesStatus()) {
|
||||
showTooManyUsagesWarning(myProject, tooManyUsagesStatus, indicator, myUsageCountWithoutDefinition.get(), usageView);
|
||||
}
|
||||
if (usageCount > UsageLimitUtil.USAGES_LIMIT && tooManyUsagesStatus.switchTooManyUsagesStatus()) {
|
||||
showTooManyUsagesWarning(myProject, tooManyUsagesStatus, indicator, myPresentation, usageCount, usageView);
|
||||
}
|
||||
|
||||
if (usageView != null) {
|
||||
|
||||
@@ -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,7 +15,11 @@
|
||||
*/
|
||||
package com.intellij.usages.impl.rules;
|
||||
|
||||
import com.intellij.BundleBase;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class UsageType {
|
||||
public static final UsageType CLASS_INSTANCE_OF = new UsageType(UsageViewBundle.message("usage.type.instanceof"));
|
||||
@@ -43,6 +47,7 @@ public final class UsageType {
|
||||
public static final UsageType LITERAL_USAGE = new UsageType(UsageViewBundle.message("usage.type.string.constant"));
|
||||
public static final UsageType COMMENT_USAGE = new UsageType(UsageViewBundle.message("usage.type.comment"));
|
||||
|
||||
@SuppressWarnings("UnresolvedPropertyKey")
|
||||
public static final UsageType UNCLASSIFIED = new UsageType(UsageViewBundle.message("usage.type.unclassified"));
|
||||
|
||||
public static final UsageType RECURSION = new UsageType("Recursion");
|
||||
@@ -53,10 +58,17 @@ public final class UsageType {
|
||||
|
||||
private final String myName;
|
||||
|
||||
public UsageType(String name) {
|
||||
public UsageType(@NotNull String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String toString(@NotNull UsageViewPresentation presentation) {
|
||||
String word = presentation.getUsagesWord();
|
||||
String usageWord = StringUtil.startsWithChar(myName, '{') ? StringUtil.capitalize(word) : word;
|
||||
return BundleBase.format(myName, usageWord);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -81,7 +81,7 @@ public class UsageTypeGroupingRule implements UsageGroupingRuleEx {
|
||||
return null;
|
||||
}
|
||||
|
||||
private class UsageTypeGroup implements UsageGroup {
|
||||
private static class UsageTypeGroup implements UsageGroup {
|
||||
private final UsageType myUsageType;
|
||||
|
||||
private UsageTypeGroup(@NotNull UsageType usageType) {
|
||||
@@ -99,8 +99,8 @@ public class UsageTypeGroupingRule implements UsageGroupingRuleEx {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getText(UsageView view) {
|
||||
return myUsageType.toString();
|
||||
public String getText(@Nullable UsageView view) {
|
||||
return view == null ? myUsageType.toString() : myUsageType.toString(view.getPresentation());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,12 +129,11 @@ public class UsageTypeGroupingRule implements UsageGroupingRuleEx {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof UsageTypeGroup)) return false;
|
||||
final UsageTypeGroup usageTypeGroup = (UsageTypeGroup)o;
|
||||
if (myUsageType != null ? !myUsageType.equals(usageTypeGroup.myUsageType) : usageTypeGroup.myUsageType != null) return false;
|
||||
return true;
|
||||
return myUsageType.equals(usageTypeGroup.myUsageType);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return myUsageType != null ? myUsageType.hashCode() : 0;
|
||||
return myUsageType.hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.intellij.psi.xml.XmlAttribute;
|
||||
import com.intellij.psi.xml.XmlAttributeValue;
|
||||
import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usages.FindUsagesProcessPresentation;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import com.intellij.util.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -326,7 +327,7 @@ public class IconsReferencesContributor extends PsiReferenceContributor implemen
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}, new FindUsagesProcessPresentation());
|
||||
}, new FindUsagesProcessPresentation(new UsageViewPresentation()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -478,7 +478,7 @@ inspection.i18n.message.in.form=Hard coded string literal in form: ''{0}''
|
||||
command.paste=Paste
|
||||
add.component.error.qualified.name.required=Please enter a qualified class name
|
||||
add.component.error.component.required=Please select a class derived from JComponent
|
||||
form.usage.type=Usage in GUI form
|
||||
form.usage.type={0} in GUI form
|
||||
unsupported.component.class.version=Unsupported component class version
|
||||
field.is.overwritten.by.generated.code=Field ''{0}'' is overwritten by generated code
|
||||
bound.field.type.mismatch=Types of GUI component (''{0}'') and bound field (''{1}'') do not match
|
||||
|
||||
@@ -310,7 +310,7 @@ public class XPathEvalAction extends XPathAction {
|
||||
|
||||
presentation.setOpenInNewTab(XPathAppComponent.getInstance().getConfig().OPEN_NEW_TAB);
|
||||
|
||||
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation();
|
||||
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
|
||||
processPresentation.setProgressIndicatorFactory(new Factory<ProgressIndicator>() {
|
||||
@Override
|
||||
public ProgressIndicator create() {
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ public class FindByXPathAction extends AnAction {
|
||||
|
||||
presentation.setOpenInNewTab(settings.OPEN_NEW_TAB);
|
||||
|
||||
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation();
|
||||
final FindUsagesProcessPresentation processPresentation = new FindUsagesProcessPresentation(presentation);
|
||||
processPresentation.setProgressIndicatorFactory(new Factory<ProgressIndicator>() {
|
||||
public ProgressIndicator create() {
|
||||
return new FindProgressIndicator(project, scope.getName());
|
||||
|
||||
Reference in New Issue
Block a user