Skip to content

Commit f689acd

Browse files
authored
Merge pull request #1642 from Haehnchen/feature/fix-listpopoup
#1614 fix "ListPopupStep" issues of PhpStorm 2021.1
2 parents 92c347e + ef98e13 commit f689acd

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/factory/ProfilerFactoryUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @author Daniel Espendiller <daniel@espendiller.net>
1010
*/
1111
public class ProfilerFactoryUtil {
12-
private static ProfilerFactoryInterface[] PROFILER = new ProfilerFactoryInterface[] {
12+
private static final ProfilerFactoryInterface[] PROFILER = new ProfilerFactoryInterface[] {
1313
new HttpProfilerFactory(),
1414
new LocalProfilerFactory(),
1515
};

src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/widget/SymfonyProfilerWidget.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package fr.adrienbrault.idea.symfony2plugin.profiler.widget;
22

3-
import com.intellij.openapi.actionSystem.ActionGroup;
4-
import com.intellij.openapi.actionSystem.AnAction;
5-
import com.intellij.openapi.actionSystem.DefaultActionGroup;
3+
import com.intellij.openapi.actionSystem.*;
64
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
75
import com.intellij.openapi.application.ApplicationManager;
86
import com.intellij.openapi.fileEditor.FileEditorManager;
97
import com.intellij.openapi.fileEditor.FileEditorManagerEvent;
108
import com.intellij.openapi.project.Project;
119
import com.intellij.openapi.ui.popup.ListPopup;
1210
import com.intellij.openapi.vfs.VirtualFile;
11+
import com.intellij.openapi.wm.IdeFocusManager;
1312
import com.intellij.openapi.wm.StatusBarWidget;
1413
import com.intellij.openapi.wm.impl.status.EditorBasedWidget;
1514
import com.intellij.ui.popup.PopupFactoryImpl;
@@ -144,8 +143,30 @@ private void attachProfileItem(Collection<AnAction> controllerActions, Map<Strin
144143
@Nullable
145144
@Override
146145
public ListPopup getPopupStep() {
146+
if (isDisposed()) {
147+
return null;
148+
}
149+
147150
ActionGroup popupGroup = getActions();
148-
return new PopupFactoryImpl.ActionGroupPopup("Symfony Profiler", popupGroup, SimpleDataContext.getProjectContext(getProject()), false, false, false, true, null, -1, null, null);
151+
152+
DataContext dataContext = SimpleDataContext.builder()
153+
.add(CommonDataKeys.PROJECT, getProject())
154+
.add(PlatformDataKeys.CONTEXT_COMPONENT, IdeFocusManager.getInstance(getProject()).getFocusOwner())
155+
.build();
156+
157+
return new PopupFactoryImpl.ActionGroupPopup(
158+
"Symfony Profiler",
159+
popupGroup,
160+
dataContext,
161+
false,
162+
false,
163+
false,
164+
true,
165+
null,
166+
-1,
167+
null,
168+
null
169+
);
149170
}
150171

151172
@Nullable

0 commit comments

Comments
 (0)