IDEA-97166 Replace in Path replaces all occurences on line instead of current occurrence

This commit is contained in:
andrey.zaytsev
2012-12-18 15:00:35 +04:00
parent d81b40752d
commit c9eef827e9
3 changed files with 16 additions and 4 deletions
@@ -150,7 +150,7 @@ public class ReplaceInProjectManager {
FindUsagesProcessPresentation processPresentation,
final FindManager findManager) {
final ReplaceContext[] context = new ReplaceContext[1];
presentation.setDupLinesFilterAvailable(false);
manager.searchAndShowUsages(new UsageTarget[]{new FindInProjectUtil.StringUsageTarget(findModelCopy.getStringToFind())},
usageSearcherFactory, processPresentation, presentation, new UsageViewManager.UsageViewStateListener() {
@Override
@@ -44,6 +44,7 @@ public class UsageViewPresentation {
private List<Action> myNotFoundActions;
private boolean myDetachedMode; // no UI will be shown
private String myDynamicCodeUsagesString;
private boolean myDupLinesFilterAvailable = true;
public String getTabText() {
return myTabText;
@@ -174,5 +175,13 @@ public class UsageViewPresentation {
public String getDynamicCodeUsagesString() {
return myDynamicCodeUsagesString;
}
public boolean isDupLinesFilterAvailable() {
return myDupLinesFilterAvailable;
}
public void setDupLinesFilterAvailable(boolean dupLinesFilterAvailable) {
myDupLinesFilterAvailable = dupLinesFilterAvailable;
}
}
@@ -469,9 +469,12 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
public void addFilteringActions(@NotNull DefaultActionGroup group) {
final JComponent component = getComponent();
final MergeDupLines mergeDupLines = new MergeDupLines();
mergeDupLines.registerCustomShortcutSet(mergeDupLines.getShortcutSet(), component, this);
group.add(mergeDupLines);
if (getPresentation().isDupLinesFilterAvailable()) {
final MergeDupLines mergeDupLines = new MergeDupLines();
mergeDupLines.registerCustomShortcutSet(mergeDupLines.getShortcutSet(), component, this);
group.add(mergeDupLines);
}
final UsageFilteringRuleProvider[] providers = Extensions.getExtensions(UsageFilteringRuleProvider.EP_NAME);
for (UsageFilteringRuleProvider provider : providers) {