[maven] IDEA-355840 convert DownloadActionGroup to kotlin

GitOrigin-RevId: cf6dbd9bf0003dfc538c537c596e9f4fff6578c0
This commit is contained in:
Dmitry Kichinsky
2024-10-14 13:35:19 +00:00
committed by intellij-monorepo-bot
parent ef4d74830f
commit 7b4f92c6ab
@@ -1,43 +1,25 @@
/*
* Copyright 2000-2010 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.idea.maven.project.actions;
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.project.actions
import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.project.DumbAware;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.maven.project.MavenProjectsManager;
import org.jetbrains.idea.maven.utils.actions.MavenActionUtil;
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.project.DumbAware
import org.jetbrains.idea.maven.utils.actions.MavenActionUtil
public class DownloadActionGroup extends DefaultActionGroup implements DumbAware {
@Override
public void update(@NotNull AnActionEvent e) {
super.update(e);
e.getPresentation().setEnabled(isEnabled(e));
class DownloadActionGroup : DefaultActionGroup(), DumbAware {
override fun update(e: AnActionEvent) {
super.update(e)
e.presentation.setEnabled(isEnabled(e))
}
@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.BGT
}
private static boolean isEnabled(AnActionEvent e) {
if(!MavenActionUtil.hasProject(e.getDataContext())) return false;
final MavenProjectsManager projectsManager = MavenActionUtil.getProjectsManager(e.getDataContext());
return projectsManager != null && projectsManager.isMavenizedProject();
private fun isEnabled(e: AnActionEvent): Boolean {
if (!MavenActionUtil.hasProject(e.dataContext)) return false
val projectsManager = MavenActionUtil.getProjectsManager(e.dataContext)
return projectsManager != null && projectsManager.isMavenizedProject
}
}