mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
vcs: hide git/hg/svn init actions in the safe mode
GitOrigin-RevId: 8ac1e322d7e35e81882590e50a5716b7fb2a44af
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4727c201f6
commit
cdc4f1ffc1
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package git4idea.actions;
|
||||
|
||||
import com.intellij.ide.impl.TrustedProjects;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.fileChooser.FileChooser;
|
||||
@@ -30,6 +31,12 @@ import static git4idea.GitNotificationIdsHolder.INIT_FAILED;
|
||||
|
||||
public class GitInit extends DumbAwareAction {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
e.getPresentation().setEnabledAndVisible(project == null || project.isDefault() || TrustedProjects.isTrusted(project));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.zmlx.hg4idea.action;
|
||||
|
||||
import com.intellij.ide.impl.TrustedProjects;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.progress.util.BackgroundTaskUtil;
|
||||
@@ -36,6 +37,12 @@ public class HgInit extends DumbAwareAction {
|
||||
|
||||
private Project myProject;
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
e.getPresentation().setEnabledAndVisible(project == null || project.isDefault() || TrustedProjects.isTrusted(project));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
myProject = notNull(e.getData(CommonDataKeys.PROJECT), ProjectManager.getInstance().getDefaultProject());
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.idea.svn.actions;
|
||||
|
||||
import com.intellij.ide.impl.TrustedProjects;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
@@ -12,16 +12,14 @@ import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.svn.dialogs.ImportDialog;
|
||||
|
||||
/**
|
||||
* @author alex
|
||||
*/
|
||||
public class ImportToRepositoryAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void update(@NotNull final AnActionEvent e) {
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final Presentation presentation = e.getPresentation();
|
||||
presentation.setEnabled(presentation.isEnabled() &&
|
||||
(project == null || (! ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning())));
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
e.getPresentation().setEnabled(
|
||||
project == null ||
|
||||
TrustedProjects.isTrusted(project) && !ProjectLevelVcsManager.getInstance(project).isBackgroundVcsOperationRunning()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user