Files
openide/platform/execution.serviceView/src/JumpToServicesAction.java
Daniil Ovchinnikov 1b4397dbe0 extract intellij.platform.execution.serviceView
GitOrigin-RevId: f17a34d85fe64a6fe92b83afc03258a95c83e36e
2024-05-31 21:55:04 +00:00

35 lines
1.2 KiB
Java

// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.platform.execution.serviceView;
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NotNull;
import static com.intellij.platform.execution.serviceView.ServiceViewActionProvider.getSelectedView;
final class JumpToServicesAction extends DumbAwareAction {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
ServiceView selectedView = getSelectedView(e);
if (selectedView == null) return;
selectedView.jumpToServices();
}
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
@Override
public void update(@NotNull AnActionEvent e) {
Presentation presentation = e.getPresentation();
presentation.setVisible(false);
ServiceView selectedView = getSelectedView(e);
presentation.setEnabled(selectedView != null && !(selectedView.getModel() instanceof ServiceViewModel.SingeServiceModel));
}
}