mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
diff: remove duplicated "Show Diff" actions from FindAction
These actions reuse shortcuts and presentation of each other. This leads to confusion, when "Find Action" has 5 different actions with same presentation. This is a serious issue, as some of them can be enabled in the same context, doing different things. And if the shortcut invoked, the "wrong" action might happen. For example: "Shelve" toolwindow had two actions available (one is Shelve-specific, and another just finds List<Change> in DataContext).
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.diff.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionExtensionProvider;
|
||||
import com.intellij.openapi.actionSystem.ExtendableAction;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
|
||||
public class ShowDiffAction extends ExtendableAction implements DumbAware {
|
||||
private static final ExtensionPointName<AnActionExtensionProvider> EP_NAME =
|
||||
ExtensionPointName.create("com.intellij.diff.actions.ShowDiffAction.ExtensionProvider");
|
||||
|
||||
public ShowDiffAction() {
|
||||
super(EP_NAME);
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -22,6 +22,7 @@ import com.intellij.diff.contents.DocumentContent;
|
||||
import com.intellij.diff.requests.DiffRequest;
|
||||
import com.intellij.diff.requests.SimpleDiffRequest;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -41,7 +42,7 @@ public class ShowLineStatusRangeDiffAction extends DumbAwareAction {
|
||||
public ShowLineStatusRangeDiffAction(@NotNull LineStatusTrackerBase lineStatusTracker, @NotNull Range range, @Nullable Editor editor) {
|
||||
myLineStatusTracker = lineStatusTracker;
|
||||
myRange = range;
|
||||
ActionUtil.copyFrom(this, "ChangesView.Diff");
|
||||
ActionUtil.copyFrom(this, IdeActions.ACTION_SHOW_DIFF_COMMON);
|
||||
}
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.openapi.actionSystem;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Allows to override AnAction behavior in some context,
|
||||
* not affecting the others.
|
||||
*
|
||||
* Note, that various flags cannot be overridden. Ex:
|
||||
* {@link AnAction#isEnabledInModalContext()}
|
||||
* {@link AnAction#isDumbAware()}
|
||||
* {@link AnAction#isTransparentUpdate()}
|
||||
*
|
||||
* @see ExtendableAction
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public interface AnActionExtensionProvider {
|
||||
/**
|
||||
* @return whether current provider should be used in given context
|
||||
* <p>
|
||||
* Provider should not modify presentation in this method.
|
||||
* Only the first active provider will be used.
|
||||
*/
|
||||
boolean isActive(@NotNull AnActionEvent e);
|
||||
|
||||
void update(@NotNull AnActionEvent e);
|
||||
|
||||
void actionPerformed(@NotNull AnActionEvent e);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.openapi.actionSystem;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ApiStatus.Experimental
|
||||
public class ExtendableAction extends AnAction {
|
||||
@NotNull private final ExtensionPointName<AnActionExtensionProvider> myExtensionPoint;
|
||||
|
||||
public ExtendableAction(@NotNull ExtensionPointName<AnActionExtensionProvider> extensionPoint) {
|
||||
myExtensionPoint = extensionPoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void update(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().copyFrom(getTemplatePresentation());
|
||||
|
||||
AnActionExtensionProvider provider = getProvider(e);
|
||||
if (provider != null) {
|
||||
provider.update(e);
|
||||
}
|
||||
else {
|
||||
defaultUpdate(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void actionPerformed(@NotNull AnActionEvent e) {
|
||||
AnActionExtensionProvider provider = getProvider(e);
|
||||
if (provider != null) {
|
||||
provider.actionPerformed(e);
|
||||
}
|
||||
else {
|
||||
defaultActionPerformed(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private AnActionExtensionProvider getProvider(@NotNull AnActionEvent e) {
|
||||
return ContainerUtil.find(myExtensionPoint.getExtensions(), provider -> provider.isActive(e));
|
||||
}
|
||||
|
||||
protected void defaultUpdate(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabledAndVisible(false);
|
||||
}
|
||||
|
||||
protected void defaultActionPerformed(@NotNull AnActionEvent e) {
|
||||
}
|
||||
}
|
||||
@@ -1253,7 +1253,7 @@ action.ChangesView.SetDefault.description=Set changelist to which new changes ar
|
||||
action.ChangesView.Move.text=Move to Another Changelist...
|
||||
action.ChangesView.Move.description=Move selected changes to another changelist
|
||||
action.ChangesView.Diff.text=Show Diff
|
||||
action.ChangesView.Diff.description=Show diff for selected change
|
||||
action.ChangesView.Diff.description=Compare files or revisions
|
||||
action.ChangesView.DeleteUnversioned.text=Delete
|
||||
action.ChangesView.DeleteUnversioned.description=
|
||||
action.ChangesView.AddUnversioned.text=Add to VCS
|
||||
@@ -1388,9 +1388,6 @@ action.SliceBackward.description=Search for values which can be assigned to sele
|
||||
action.SliceForward.text=Analyze Data Flow _from Here
|
||||
action.SliceSliceForward.description=Search for values escaped from this location
|
||||
|
||||
action.ShelvedChanges.Diff.text=Show Diff
|
||||
action.ShelvedChanges.Diff.description=Show diff for selected change
|
||||
|
||||
action.ChangeTemplateDataLanguage.text=Change Template Data Language
|
||||
|
||||
group.FileOpenGroup.text=File Open Actions
|
||||
@@ -1568,9 +1565,6 @@ action.Images.Thumbnails.Hide.description=Close thumbnails window
|
||||
action.Images.ShowThumbnails.text=Show Image Thumbnails
|
||||
action.Images.ShowThumbnails.description=Show thumbnails view for current directory
|
||||
|
||||
action.Diff.UpdatedFiles.text=Show Diff
|
||||
action.Diff.UpdatedFiles.description=Show diff with version before update
|
||||
|
||||
action.TabList.text=Show Hidden Tabs
|
||||
action.TabList.description=Show dropdown with the list of tabs that don't fit on the screen in single-row tab layout
|
||||
|
||||
|
||||
@@ -257,6 +257,8 @@
|
||||
<extensionPoint qualifiedName="com.intellij.diff.lang.DiffIgnoredRangeProvider" interface="com.intellij.diff.lang.DiffIgnoredRangeProvider"/>
|
||||
<extensionPoint name="testStatusListener" interface="com.intellij.execution.testframework.TestStatusListener"/>
|
||||
|
||||
<extensionPoint name="diff.actions.ShowDiffAction.ExtensionProvider" interface="com.intellij.openapi.actionSystem.AnActionExtensionProvider"/>
|
||||
|
||||
<extensionPoint name="runConfigurationBeforeRunProviderDelegate" interface="com.intellij.execution.impl.RunConfigurationBeforeRunProviderDelegate"/>
|
||||
|
||||
<extensionPoint name="jbProtocolCommand" interface="com.intellij.openapi.application.JBProtocolCommand"/>
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
<diff.DiffTool implementation="com.intellij.openapi.vcs.changes.patch.tool.ApplyPatchDiffTool"/>
|
||||
<diff.DiffTool implementation="com.intellij.openapi.vcs.changes.patch.tool.PatchDiffTool"/>
|
||||
|
||||
<diff.actions.ShowDiffAction.ExtensionProvider implementation="com.intellij.openapi.vcs.changes.shelf.DiffShelvedChangesAction"/>
|
||||
<diff.actions.ShowDiffAction.ExtensionProvider implementation="com.intellij.openapi.vcs.update.ShowUpdatedDiffAction"/>
|
||||
<diff.actions.ShowDiffAction.ExtensionProvider implementation="com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction" order="last"/>
|
||||
|
||||
<selectInTarget implementation="com.intellij.openapi.vcs.changes.SelectInChangesViewTarget"/>
|
||||
|
||||
<search.topHitProvider implementation="com.intellij.openapi.vcs.configurable.VcsOptionsTopHitProvider"/>
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
<action id="Refresh" class="com.intellij.ide.actions.RefreshAction"/>
|
||||
|
||||
<group id="Diff.KeymapGroup" text="Diff \&\& Merge">
|
||||
<action id="Diff.ShowDiff" class="com.intellij.openapi.actionSystem.EmptyAction" icon="AllIcons.Actions.Diff"/> <!-- CommonShortcuts.getDiff() -->
|
||||
<action id="Diff.ShowDiff" class="com.intellij.diff.actions.ShowDiffAction" icon="AllIcons.Actions.Diff"/> <!-- CommonShortcuts.getDiff() -->
|
||||
<action id="CompareTwoFiles" class="com.intellij.diff.actions.CompareFilesAction" icon="AllIcons.Actions.Diff"/>
|
||||
<action id="CompareFileWithEditor" class="com.intellij.diff.actions.CompareFileWithEditorAction"/>
|
||||
<action id="CompareClipboardWithSelection" class="com.intellij.diff.actions.CompareClipboardWithSelectionAction" icon="AllIcons.Actions.DiffWithClipboard"/>
|
||||
|
||||
@@ -97,8 +97,7 @@
|
||||
text="Shelve Silently" description="Shelve changes to appropriate shelved changelists" icon="AllIcons.Vcs.ShelveSilent">
|
||||
<keyboard-shortcut first-keystroke="control alt H" keymap="$default"/>
|
||||
</action>
|
||||
<action id="ChangesView.Diff" class="com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction"
|
||||
icon="AllIcons.Actions.Diff" use-shortcut-of="Diff.ShowDiff"/>
|
||||
<action id="ChangesView.Diff" class="com.intellij.diff.actions.ShowDiffAction" icon="AllIcons.Actions.Diff" use-shortcut-of="Diff.ShowDiff"/>
|
||||
</group>
|
||||
|
||||
<group id="AlienCommitChangesDialog.AdditionalActions"/>
|
||||
@@ -107,7 +106,7 @@
|
||||
<reference ref="CheckinProject"/>
|
||||
<reference ref="ChangesView.Revert"/>
|
||||
<reference ref="ChangesView.Move"/>
|
||||
<reference ref="ChangesView.Diff"/>
|
||||
<reference ref="Diff.ShowDiff"/>
|
||||
<reference ref="EditSource"/>
|
||||
<separator/>
|
||||
<action id="ChangesView.DeleteUnversioned" class="com.intellij.openapi.vcs.changes.actions.DeleteUnversionedFilesAction"
|
||||
@@ -146,8 +145,7 @@
|
||||
<action id="ShelveChanges.UnshelveWithDialog" class="com.intellij.openapi.vcs.changes.shelf.UnshelveWithDialogAction"
|
||||
text="Unshelve..." description="Correct paths where to apply patches and unshelve" icon="AllIcons.Vcs.Unshelve"/>
|
||||
<action id="ShelvedChanges.Restore" class="com.intellij.openapi.vcs.changes.shelf.RestoreShelvedChange"/>
|
||||
<action id="ShelvedChanges.Diff" class="com.intellij.openapi.vcs.changes.shelf.DiffShelvedChangesAction"
|
||||
icon="AllIcons.Actions.Diff" use-shortcut-of="Diff.ShowDiff"/>
|
||||
<reference id="Diff.ShowDiff"/>
|
||||
<action id="ShelvedChanges.DiffWithLocal" class="com.intellij.openapi.vcs.changes.shelf.DiffShelvedChangesWithLocalAction"
|
||||
text="Compare with Local" description="Compare shelved version with current" use-shortcut-of="Vcs.ShowDiffWithLocal"
|
||||
icon="AllIcons.Actions.DiffWithCurrent"/>
|
||||
@@ -166,7 +164,7 @@
|
||||
</group>
|
||||
|
||||
<group id="ShelvedChangesToolbar">
|
||||
<reference ref="ShelvedChanges.Diff"/>
|
||||
<reference ref="Diff.ShowDiff"/>
|
||||
<action id="ChangesView.UnshelveSilently" class="com.intellij.openapi.vcs.changes.actions.UnshelveSilentlyAction"
|
||||
text="Unshelve Silently" description="Unshelve changes to appropriate changelists" icon="AllIcons.Vcs.UnshelveSilent">
|
||||
<keyboard-shortcut first-keystroke="control alt U" keymap="$default"/>
|
||||
@@ -239,8 +237,7 @@
|
||||
<group id="UpdateActionGroup">
|
||||
<reference ref="EditSource"/>
|
||||
<reference ref="$Delete"/>
|
||||
<action id="Diff.UpdatedFiles" class="com.intellij.openapi.vcs.update.ShowUpdatedDiffAction"
|
||||
use-shortcut-of="Diff.ShowDiff" icon="AllIcons.Actions.Diff"/>
|
||||
<reference id="Diff.ShowDiff"/>
|
||||
</group>
|
||||
|
||||
<action id="Vcs.ReformatCommitMessage" class="com.intellij.vcs.commit.ReformatCommitMessageAction" use-shortcut-of="ReformatCode"/>
|
||||
@@ -300,7 +297,7 @@
|
||||
<separator/>
|
||||
<reference ref="ShelvedChanges.Rename"/>
|
||||
<separator/>
|
||||
<reference ref="ShelvedChanges.Diff"/>
|
||||
<reference ref="Diff.ShowDiff"/>
|
||||
<reference ref="ChangesView.CreatePatchFromChanges"/>
|
||||
<separator/>
|
||||
<reference ref="ShelvedChanges.ShowHideDeleted"/>
|
||||
@@ -353,7 +350,7 @@
|
||||
<reference ref="ChangesView.RemoveChangeList"/>
|
||||
<reference ref="ChangesView.SetDefault"/>
|
||||
<reference ref="ChangesView.Move"/>
|
||||
<reference ref="ChangesView.Diff"/>
|
||||
<reference ref="Diff.ShowDiff"/>
|
||||
<reference ref="ChangesView.DeleteUnversioned"/>
|
||||
<reference ref="ChangesView.AddUnversioned"/>
|
||||
<reference ref="ChangesView.Ignore"/>
|
||||
|
||||
@@ -17,9 +17,9 @@ package com.intellij.openapi.vcs.actions;
|
||||
|
||||
import com.intellij.diff.DiffDialogHints;
|
||||
import com.intellij.diff.util.DiffUserDataKeysEx;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.diff.DiffNavigationContext;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
@@ -62,9 +62,7 @@ class ShowDiffFromAnnotation extends DumbAwareAction implements UpToDateLineNumb
|
||||
private boolean myEnabled;
|
||||
|
||||
ShowDiffFromAnnotation(final FileAnnotation fileAnnotation, final AbstractVcs vcs, final VirtualFile file) {
|
||||
super(ActionsBundle.message("action.Diff.UpdatedFiles.text"),
|
||||
ActionsBundle.message("action.Diff.UpdatedFiles.description"),
|
||||
AllIcons.Actions.Diff);
|
||||
ActionUtil.copyFrom(this, IdeActions.ACTION_SHOW_DIFF_COMMON);
|
||||
myFileAnnotation = fileAnnotation;
|
||||
myVcs = vcs;
|
||||
myFile = file;
|
||||
|
||||
@@ -176,7 +176,7 @@ public class ChangesViewManager implements ChangesViewI, ProjectComponent, Persi
|
||||
EmptyAction.registerWithShortcutSet(IdeActions.MOVE_TO_ANOTHER_CHANGE_LIST, CommonShortcuts.getMove(), panel);
|
||||
EmptyAction.registerWithShortcutSet("ChangesView.Rename",CommonShortcuts.getRename() , panel);
|
||||
EmptyAction.registerWithShortcutSet("ChangesView.SetDefault", new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_U, InputEvent.ALT_DOWN_MASK | ctrlMask())), panel);
|
||||
EmptyAction.registerWithShortcutSet("ChangesView.Diff", CommonShortcuts.getDiff(), panel);
|
||||
EmptyAction.registerWithShortcutSet(IdeActions.ACTION_SHOW_DIFF_COMMON, CommonShortcuts.getDiff(), panel);
|
||||
|
||||
DefaultActionGroup group = (DefaultActionGroup)ActionManager.getInstance().getAction("ChangesViewToolbar");
|
||||
ActionToolbar toolbar = ActionManager.getInstance().createActionToolbar(ActionPlaces.CHANGES_VIEW_TOOLBAR, group, false);
|
||||
|
||||
+10
-9
@@ -19,13 +19,8 @@ import com.intellij.diff.DiffManager;
|
||||
import com.intellij.diff.chains.DiffRequestChain;
|
||||
import com.intellij.diff.util.DiffUserDataKeys;
|
||||
import com.intellij.idea.ActionsBundle;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Key;
|
||||
@@ -40,9 +35,13 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ShowDiffAction extends AnAction implements DumbAware {
|
||||
private static final Logger LOG = Logger.getInstance(ShowDiffAction.class);
|
||||
public class ShowDiffAction implements AnActionExtensionProvider {
|
||||
@Override
|
||||
public boolean isActive(@NotNull AnActionEvent e) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Change[] changes = e.getData(VcsDataKeys.CHANGES);
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
@@ -66,6 +65,7 @@ public class ShowDiffAction extends AnAction implements DumbAware {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(@NotNull final AnActionEvent e) {
|
||||
final Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
final Change[] changes = e.getData(VcsDataKeys.CHANGES);
|
||||
@@ -110,7 +110,8 @@ public class ShowDiffAction extends AnAction implements DumbAware {
|
||||
|
||||
if (needsConversion) {
|
||||
ChangeListManager.getInstance(project).invokeAfterUpdate(performer, InvokeAfterUpdateMode.BACKGROUND_CANCELLABLE,
|
||||
ActionsBundle.actionText("ChangesView.Diff"), ModalityState.current());
|
||||
ActionsBundle.actionText(IdeActions.ACTION_SHOW_DIFF_COMMON),
|
||||
ModalityState.current());
|
||||
}
|
||||
else {
|
||||
performer.run();
|
||||
|
||||
+12
-9
@@ -28,10 +28,7 @@ import com.intellij.diff.requests.SimpleDiffRequest;
|
||||
import com.intellij.diff.requests.UnknownFileTypeDiffRequest;
|
||||
import com.intellij.diff.tools.util.SoftHardCacheMap;
|
||||
import com.intellij.diff.util.DiffUtil;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.diff.impl.patch.*;
|
||||
import com.intellij.openapi.diff.impl.patch.apply.ApplyFilePatchBase;
|
||||
import com.intellij.openapi.diff.impl.patch.apply.GenericPatchApplier;
|
||||
@@ -39,7 +36,6 @@ import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileTypes.UnknownFileType;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.UserDataHolder;
|
||||
import com.intellij.openapi.util.UserDataHolderBase;
|
||||
@@ -77,18 +73,25 @@ import static com.intellij.openapi.vcs.changes.patch.PatchDiffRequestFactory.cre
|
||||
import static com.intellij.util.ObjectUtils.assertNotNull;
|
||||
import static com.intellij.util.ObjectUtils.chooseNotNull;
|
||||
|
||||
public class DiffShelvedChangesAction extends AnAction implements DumbAware {
|
||||
|
||||
public class DiffShelvedChangesAction implements AnActionExtensionProvider {
|
||||
private static final String DIFF_WITH_BASE_ERROR = "Base content not found or not applicable.";
|
||||
public static final String SHELVED_VERSION = "Shelved Version";
|
||||
public static final String BASE_VERSION = "Base Version";
|
||||
public static final String CURRENT_VERSION = "Current Version";
|
||||
|
||||
public void update(final AnActionEvent e) {
|
||||
@Override
|
||||
public boolean isActive(@NotNull AnActionEvent e) {
|
||||
return e.getData(ShelvedChangesViewManager.SHELVED_CHANGELIST_KEY) != null ||
|
||||
e.getData(ShelvedChangesViewManager.SHELVED_RECYCLED_CHANGELIST_KEY) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(isEnabled(e.getDataContext()));
|
||||
}
|
||||
|
||||
public void actionPerformed(final AnActionEvent e) {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
showShelvedChangesDiff(e.getDataContext());
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -16,10 +16,16 @@
|
||||
package com.intellij.openapi.vcs.changes.shelf;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.project.DumbAwareAction;
|
||||
|
||||
public class DiffShelvedChangesWithLocalAction extends DumbAwareAction {
|
||||
@Override
|
||||
public void update(final AnActionEvent e) {
|
||||
e.getPresentation().setEnabled(DiffShelvedChangesAction.isEnabled(e.getDataContext()));
|
||||
}
|
||||
|
||||
public class DiffShelvedChangesWithLocalAction extends DiffShelvedChangesAction {
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
showShelvedChangesDiff(e.getDataContext(), true);
|
||||
DiffShelvedChangesAction.showShelvedChangesDiff(e.getDataContext(), true);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ public class ShelvedChangesViewManager implements ProjectComponent {
|
||||
DnDSupport.createBuilder(myTree).disableAsTarget().setImageProvider(this::createDraggedImage).setBeanProvider(this::createDragStartBean)
|
||||
.install();
|
||||
|
||||
final AnAction showDiffAction = ActionManager.getInstance().getAction("ShelvedChanges.Diff");
|
||||
final AnAction showDiffAction = ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_DIFF_COMMON);
|
||||
showDiffAction.registerCustomShortcutSet(showDiffAction.getShortcutSet(), myTree);
|
||||
final EditSourceAction editSourceAction = new EditSourceAction();
|
||||
editSourceAction.registerCustomShortcutSet(editSourceAction.getShortcutSet(), myTree);
|
||||
|
||||
@@ -377,7 +377,7 @@ public abstract class ChangesBrowserBase<T> extends JPanel implements TypeSafeDa
|
||||
showDiff();
|
||||
}
|
||||
};
|
||||
ActionUtil.copyFrom(myDiffAction, "ChangesView.Diff");
|
||||
ActionUtil.copyFrom(myDiffAction, IdeActions.ACTION_SHOW_DIFF_COMMON);
|
||||
myDiffAction.registerCustomShortcutSet(myViewer, null);
|
||||
toolBarGroup.add(myDiffAction);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.intellij.history.Label;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.UserDataHolder;
|
||||
@@ -48,12 +47,18 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ShowUpdatedDiffAction extends AnAction implements DumbAware {
|
||||
public class ShowUpdatedDiffAction implements AnActionExtensionProvider {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
public boolean isActive(@NotNull AnActionEvent e) {
|
||||
return isVisible(e.getDataContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
final DataContext dc = e.getDataContext();
|
||||
|
||||
final Presentation presentation = e.getPresentation();
|
||||
presentation.setDescription("Show diff with version before update");
|
||||
|
||||
//presentation.setVisible(isVisible(dc));
|
||||
presentation.setEnabled(isVisible(dc) && isEnabled(dc));
|
||||
@@ -69,7 +74,8 @@ public class ShowUpdatedDiffAction extends AnAction implements DumbAware {
|
||||
return iterable != null;
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final DataContext dc = e.getDataContext();
|
||||
if ((!isVisible(dc)) || (!isEnabled(dc))) return;
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton {
|
||||
group.add(new FilterAction());
|
||||
group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_EXPAND_ALL));
|
||||
group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_COLLAPSE_ALL));
|
||||
group.add(ActionManager.getInstance().getAction("Diff.UpdatedFiles"));
|
||||
group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_SHOW_DIFF_COMMON));
|
||||
}
|
||||
|
||||
protected JComponent createCenterPanel() {
|
||||
|
||||
@@ -34,8 +34,9 @@
|
||||
<applicationService serviceInterface="com.intellij.vcs.log.VcsLogFileHistoryProvider"
|
||||
serviceImplementation="com.intellij.vcs.log.history.VcsLogFileHistoryProviderImpl"/>
|
||||
|
||||
<actionPromoter implementation="com.intellij.vcs.log.ui.actions.VcsLogActionPromoter"/>
|
||||
<getDataRule key="Vcs.FileHistory.Ui" implementationClass="com.intellij.vcs.log.history.FileHistoryUiDataRule"/>
|
||||
|
||||
<diff.actions.ShowDiffAction.ExtensionProvider implementation="com.intellij.vcs.log.ui.actions.history.CompareRevisionsFromHistoryAction"/>
|
||||
</extensions>
|
||||
|
||||
<actions>
|
||||
@@ -79,9 +80,6 @@
|
||||
use-shortcut-of="EditSource"
|
||||
text="Open Repository Version" description="Open editor with selected revision of the file"
|
||||
icon="AllIcons.Actions.EditSource"/>
|
||||
<action class="com.intellij.vcs.log.ui.actions.history.CompareRevisionsFromHistoryAction" id="Vcs.Log.ShowDiff"
|
||||
use-shortcut-of="Diff.ShowDiff" text="Show Diff" description="Show diff with previous version"
|
||||
icon="AllIcons.Actions.Diff"/>
|
||||
<action class="com.intellij.vcs.log.ui.actions.history.ShowDiffWithLocalFromHistoryAction" id="Vcs.Log.ShowDiffWithLocal"
|
||||
use-shortcut-of="Vcs.ShowDiffWithLocal"
|
||||
text="Show Diff with Local" description="Compare selected revision with the local version of the file"
|
||||
@@ -129,7 +127,7 @@
|
||||
</group>
|
||||
<group id="Vcs.FileHistory.ContextMenu">
|
||||
<reference id="Vcs.Log.OpenRepositoryVersion"/>
|
||||
<reference id="Vcs.Log.ShowDiff"/>
|
||||
<reference id="Diff.ShowDiff"/>
|
||||
<reference id="Vcs.Log.ShowDiffWithLocal"/>
|
||||
<reference id="Vcs.Log.CreatePatchFromHistory"/>
|
||||
<reference id="Vcs.Log.GetVersion"/>
|
||||
@@ -139,7 +137,7 @@
|
||||
<reference id="VcsHistoryActionsGroup"/>
|
||||
</group>
|
||||
<group id="Vcs.FileHistory.Toolbar">
|
||||
<reference id="Vcs.Log.ShowDiff"/>
|
||||
<reference id="Diff.ShowDiff"/>
|
||||
<reference id="Vcs.Log.ShowDiffWithLocal"/>
|
||||
<reference id="Vcs.Log.CreatePatchFromHistory"/>
|
||||
<reference id="Vcs.Log.GetVersion"/>
|
||||
@@ -183,7 +181,7 @@
|
||||
|
||||
<group id="Log.FileHistory.KeymapGroup" popup="false">
|
||||
<reference id="Vcs.Log.OpenRepositoryVersion"/>
|
||||
<reference id="Vcs.Log.ShowDiff"/>
|
||||
<reference id="Diff.ShowDiff"/>
|
||||
<reference id="Vcs.Log.ShowDiffWithLocal"/>
|
||||
<reference id="Vcs.Log.CreatePatchFromHistory"/>
|
||||
<reference id="Vcs.Log.GetVersion"/>
|
||||
|
||||
@@ -36,5 +36,5 @@ public class VcsLogActionPlaces {
|
||||
public static final String VCS_LOG_TEXT_FILTER_SETTINGS_ACTION = "Vcs.Log.QuickTextFilterSettings";
|
||||
public static final String VCS_LOG_FOCUS_TEXT_FILTER = "Vcs.Log.FocusTextFilter";
|
||||
public static final String VCS_LOG_SHOW_DETAILS_ACTION = "Vcs.Log.ShowDetailsAction";
|
||||
public static final String VCS_LOG_SHOW_DIFF_ACTION = "Vcs.Log.ShowDiff";
|
||||
public static final String VCS_LOG_SHOW_DIFF_ACTION = "Diff.ShowDiff";
|
||||
}
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.vcs.log.ui.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.ActionPromoter;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.DataContext;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.vcs.log.VcsLogDataKeys;
|
||||
import com.intellij.vcs.log.VcsLogUi;
|
||||
import com.intellij.vcs.log.history.FileHistoryUi;
|
||||
import com.intellij.vcs.log.ui.actions.history.CompareRevisionsFromHistoryAction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VcsLogActionPromoter implements ActionPromoter {
|
||||
|
||||
@Override
|
||||
public List<AnAction> promote(@NotNull List<AnAction> actions, @NotNull DataContext context) {
|
||||
List<AnAction> promoted = ContainerUtil.newArrayList();
|
||||
|
||||
VcsLogUi ui = VcsLogDataKeys.VCS_LOG_UI.getData(context);
|
||||
if (ui != null && ui instanceof FileHistoryUi) {
|
||||
CompareRevisionsFromHistoryAction compareAction = ContainerUtil.findInstance(actions, CompareRevisionsFromHistoryAction.class);
|
||||
if (compareAction != null) promoted.add(compareAction);
|
||||
}
|
||||
|
||||
return promoted;
|
||||
}
|
||||
}
|
||||
+7
-10
@@ -15,24 +15,16 @@
|
||||
*/
|
||||
package com.intellij.vcs.log.ui.actions.history;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.AnActionExtensionProvider;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.VcsDataKeys;
|
||||
import com.intellij.openapi.vcs.VcsException;
|
||||
import com.intellij.openapi.vcs.changes.Change;
|
||||
import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffAction;
|
||||
import com.intellij.openapi.vcs.changes.actions.diff.ShowDiffContext;
|
||||
import com.intellij.openapi.vcs.history.VcsDiffUtil;
|
||||
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.vcs.log.CommitId;
|
||||
import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
@@ -48,12 +40,17 @@ import java.util.List;
|
||||
|
||||
import static com.intellij.util.ObjectUtils.notNull;
|
||||
|
||||
public class CompareRevisionsFromHistoryAction extends AnAction implements DumbAware {
|
||||
public class CompareRevisionsFromHistoryAction implements AnActionExtensionProvider {
|
||||
private static final String COMPARE_TEXT = "Compare";
|
||||
private static final String COMPARE_DESCRIPTION = "Compare selected versions";
|
||||
private static final String DIFF_TEXT = "Show Diff";
|
||||
private static final String DIFF_DESCRIPTION = "Show diff with previous version";
|
||||
|
||||
@Override
|
||||
public boolean isActive(@NotNull AnActionEvent e) {
|
||||
return e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI) != null;
|
||||
}
|
||||
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
FileHistoryUi ui = e.getData(VcsLogInternalDataKeys.FILE_HISTORY_UI);
|
||||
|
||||
@@ -87,10 +87,10 @@
|
||||
</group>
|
||||
<action id="Subversion.MarkLocallyDeletedTreeResolved"
|
||||
class="org.jetbrains.idea.svn.actions.MarkLocallyDeletedTreeConflictResolvedAction">
|
||||
<add-to-group group-id="ChangesViewPopupMenu" anchor="after" relative-to-action="ChangesView.Diff"/>
|
||||
<add-to-group group-id="ChangesViewPopupMenu" anchor="after" relative-to-action="Diff.ShowDiff"/>
|
||||
</action>
|
||||
<reference id="Subversion.MarkTreeResolved">
|
||||
<add-to-group group-id="ChangesViewPopupMenu" anchor="after" relative-to-action="ChangesView.Diff"/>
|
||||
<add-to-group group-id="ChangesViewPopupMenu" anchor="after" relative-to-action="Diff.ShowDiff"/>
|
||||
</reference>
|
||||
<group id="SubversionUpdateActionGroup" class="org.jetbrains.idea.svn.actions.SubversionGroup">
|
||||
<reference ref="ChangesView.AddUnversioned"/>
|
||||
|
||||
Reference in New Issue
Block a user