vcs: move all vcs checkout actions onto VcsCloneDialog

GitOrigin-RevId: 82e27f01de826b1dfb75a12b07181941faa664a0
This commit is contained in:
Aleksandr Krasilnikov
2019-08-05 21:02:37 +03:00
committed by intellij-monorepo-bot
parent b429281aa9
commit 5469bab3ab
5 changed files with 25 additions and 9 deletions
@@ -30,6 +30,8 @@
text="Compare Before with Local" description="Compare version before selected revision with current version"/>
<action id="Vcs.ShowDiffWithLocal" class="com.intellij.openapi.vcs.history.actions.ShowDiffAfterWithLocalAction"
text="Compare with Local" description="Compare version in selected revision with current version"/>
<action id="Vcs.VcsClone" class="com.intellij.openapi.wm.impl.welcomeScreen.RunVcsCloneDialogAction"
text="Get from Version Control"/>
<group class="com.intellij.openapi.vcs.actions.VcsActionGroup" id="VcsGroup"/>
@@ -76,6 +78,7 @@
<separator/>
<group id="Vcs.Checkout" class="com.intellij.openapi.vcs.checkout.CheckoutActionGroup" popup="true"/>
<reference id="Vcs.VcsClone"/>
<group id="Vcs.Import" class="com.intellij.ide.actions.NonEmptyActionGroup" popup="true"/>
<group id="Vcs.Browse" class="com.intellij.ide.actions.NonEmptyActionGroup" popup="true"/>
@@ -346,11 +349,9 @@
icon="AllIcons.Welcome.FromVCS">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="first"/>
</action>
<action id="WelcomeScreen.NewGetFromVcs" class="com.intellij.openapi.wm.impl.welcomeScreen.RunVcsCloneDialogAction"
icon="AllIcons.Vcs.Clone"
internal="true">
<reference ref="Vcs.VcsClone">
<add-to-group group-id="WelcomeScreen.QuickStart" anchor="last"/>
</action>
</reference>
<action id="Vcs.CopyRevisionNumberAction" class="com.intellij.openapi.vcs.history.actions.CopyRevisionNumberAction"
text="Copy Revision Number" description="Copy short revision numbers of selected commits to the clipboard"
@@ -447,6 +448,7 @@
<reference ref="Vcs.ShowMessageHistory"/>
<reference ref="CloseAllUnmodifiedEditors"/>
<reference ref="WelcomeScreen.GetFromVcs"/>
<reference ref="Vcs.VcsClone"/>
<reference ref="Vcs.CopyRevisionNumberAction"/>
<separator/>
@@ -17,7 +17,9 @@ package com.intellij.openapi.vcs.checkout;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.ComputableActionGroup;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.vcs.CheckoutProvider;
import org.jetbrains.annotations.NotNull;
@@ -61,4 +63,10 @@ public class CheckoutActionGroup extends ComputableActionGroup.Simple {
protected AnAction createAction(CheckoutProvider provider) {
return new CheckoutAction(provider, myIdPrefix);
}
@Override
public void update(@NotNull AnActionEvent e) {
boolean useNewCloneDialogInstead = !Registry.is("vcs.use.new.clone.dialog");
e.getPresentation().setEnabledAndVisible(useNewCloneDialogInstead);
}
}
@@ -37,7 +37,7 @@ public class GetFromVcsAction extends WelcomePopupAction {
@Override
public void update(@NotNull AnActionEvent e) {
e.getPresentation().setVisible(!Registry.is("vcs.use.new.clone.dialog"));
e.getPresentation().setEnabled(CheckoutProvider.EXTENSION_POINT_NAME.hasAnyExtensions());
boolean isEnabled = !Registry.is("vcs.use.new.clone.dialog") && CheckoutProvider.EXTENSION_POINT_NAME.hasAnyExtensions();
e.getPresentation().setEnabledAndVisible(isEnabled);
}
}
@@ -1,6 +1,8 @@
// 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.
package com.intellij.openapi.wm.impl.welcomeScreen
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionPlaces
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.project.DumbAwareAction
@@ -9,11 +11,14 @@ import com.intellij.openapi.util.registry.Registry
import com.intellij.openapi.vcs.CheckoutProvider
import com.intellij.util.ui.cloneDialog.VcsCloneDialog
class RunVcsCloneDialogAction : DumbAwareAction("Get from Version Control") {
class RunVcsCloneDialogAction : DumbAwareAction() {
override fun update(e: AnActionEvent) {
e.presentation.isEnabled = CheckoutProvider.EXTENSION_POINT_NAME.hasAnyExtensions()
e.presentation.isVisible = Registry.`is`("vcs.use.new.clone.dialog")
val isEnabled = CheckoutProvider.EXTENSION_POINT_NAME.hasAnyExtensions() && Registry.`is`("vcs.use.new.clone.dialog")
e.presentation.isEnabledAndVisible = isEnabled
if (!isEnabled)
return
e.presentation.icon = if (e.place == ActionPlaces.WELCOME_SCREEN) AllIcons.Vcs.Clone else null
}
override fun actionPerformed(e: AnActionEvent) {
+1
View File
@@ -20,6 +20,7 @@
<action id="ImportProject" class="com.intellij.ide.actions.ImportProjectAction" text="Project from Existing Sources..."/>
<group id="NewProjectFromVCS" class="com.intellij.openapi.vcs.checkout.NewProjectFromVCSGroup" text="Project from Version Control"
popup="true"/>
<action class="com.intellij.openapi.wm.impl.welcomeScreen.RunVcsCloneDialogAction" text="Project from Version Control"/>
<separator/>
<action id="NewModule" class="com.intellij.openapi.roots.ui.configuration.actions.NewModuleAction" text="Module..."/>
<action id="ImportModule" class="com.intellij.ide.actions.ImportModuleAction" text="Module from Existing Sources..."/>