mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-143263
Find In Path is not autopopulating a selection from Find Preview window
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.intellij.usages.impl;
|
||||
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.*;
|
||||
@@ -34,6 +35,7 @@ import com.intellij.usageView.UsageViewBundle;
|
||||
import com.intellij.usages.UsageContextPanel;
|
||||
import com.intellij.usages.UsageView;
|
||||
import com.intellij.usages.UsageViewPresentation;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -44,7 +46,7 @@ import java.util.List;
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
public class UsagePreviewPanel extends UsageContextPanelBase implements DataProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.usages.impl.UsagePreviewPanel");
|
||||
private Editor myEditor;
|
||||
private final boolean myIsEditor;
|
||||
@@ -61,6 +63,15 @@ public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
myIsEditor = isEditor;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (CommonDataKeys.EDITOR.getName().equals(dataId) && myEditor != null) {
|
||||
return myEditor;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Provider implements UsageContextPanel.Provider {
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -211,6 +222,8 @@ public class UsagePreviewPanel extends UsageContextPanelBase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void updateLayoutLater(@Nullable final List<UsageInfo> infos) {
|
||||
if (infos == null) {
|
||||
|
||||
@@ -1572,7 +1572,10 @@ public class UsageViewImpl implements UsageView, UsageModelTracker.UsageModelTra
|
||||
VirtualFile[] data = UsageDataUtil.provideVirtualFileArray(ua, getSelectedUsageTargets());
|
||||
sink.put(CommonDataKeys.VIRTUAL_FILE_ARRAY, data);
|
||||
}
|
||||
|
||||
else if (key == CommonDataKeys.EDITOR && myCurrentUsageContextPanel instanceof DataProvider) {
|
||||
Object editor = ((DataProvider)myCurrentUsageContextPanel).getData(key.getName());
|
||||
if (editor != null) sink.put(key, editor);
|
||||
}
|
||||
else if (key == PlatformDataKeys.HELP_ID) {
|
||||
sink.put(PlatformDataKeys.HELP_ID, HELP_ID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user